home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / clx.lha / clx.doc next >
Text File  |  1993-08-06  |  323KB  |  8,491 lines

  1. ;;; -*- Mode:Text; Package:XLIB; Base:10; Fonts:(MEDFNT HL12B HL12BI) -*- 
  2.  
  3.            **** very preliminary, incomplete version ****
  4.                **** (under construction) ****
  5.  
  6. Please address all questions and comments to:
  7. Dan Stenger
  8. Texas Instruments
  9. PO Box 655474, MS 238
  10. Dallas, TX   75265
  11. (214) 995-0372
  12. stenger@ti.com
  13.  
  14.  
  15.  
  16.            CLX - Common LISP Language X Interface
  17.  
  18.                    X Window System
  19.  
  20.                 Version 11, Release 3
  21.  
  22.  
  23. Copyright (C) 1989 Texas Instruments Incorporated.
  24.  
  25. Permission is granted to any individual or institution to use, copy, modify,
  26. and distribute this documentation, provided that this complete copyright and
  27. permission notice is maintained, intact, in all copies and supporting
  28. information.
  29.  
  30. Texas Instruments Incorporated provides this documentation "as is" without
  31. express or implied warranty.
  32.  
  33.  
  34.  
  35. Copyright (C) 1985, 1986, 1987, 1988 Massachusetts Institute of Technology,
  36. Cambridge, Massachusetts, and Digital Equipment Corporation, Maynard,
  37. Massachusetts.
  38.  
  39. Permission to use, copy, modify and distribute this documentation for any
  40. purpose and without fee is hereby granted, provided that the above copyright
  41. notice appears in all copies and that both that copyright notice and this
  42. permission notice appear in supporting documentation, and that the name of
  43. M.I.T.  or Digital not be used in in advertising or publicity pertaining to
  44. distribution of the software without specific, written prior permission.
  45. M.I.T and Digital makes no representations about the suitability of the
  46. software described herein for any purpose.  It is provided "as is" without
  47. express or implied warranty.
  48.  
  49.  
  50.  
  51. The X Window System is a trademark of MIT.
  52.  
  53. UNIX is a trademark of AT&T Bell Laboratories.
  54.  
  55. ULTRIX, ULTRIX-32, ULTRIX-32m, ULTRIX-32w, and VAX/VMS are trademarks of
  56. Digital Equipment Corporation.
  57.  
  58.  
  59.  
  60.                    Acknowledgments
  61.  
  62.  
  63.         Primary Interface Author:
  64.             Robert W. Scheifler
  65.             MIT Laboratory for Computer Science
  66.             545 Technology Square, Room 418
  67.             Cambridge, MA   02139
  68.             rws@zermatt.lcs.mit.edu
  69.  
  70.         Primary Implementation Author:
  71.             LaMott Oren
  72.             Texas Instruments
  73.             PO Box 655474, MS 238
  74.             Dallas, TX   75265
  75.             oren@ti.com
  76.  
  77.         Design Contributors:
  78.             Dan Cerys, Texas Instruments
  79.             Scott Fahlman, CMU
  80.             Kerry Kimbrough, Texas Instruments
  81.             Chris Lindblad, MIT
  82.             Rob MacLachlan, CMU
  83.             Mike McMahon, Symbolics
  84.             David Moon, Symbolics
  85.             Michael Myjak, Texas Instruments
  86.             LaMott Oren, Texas Instruments
  87.             Daniel Weinreb, Symbolics
  88.             John Wroclawski, MIT
  89.             Richard Zippel, Symbolics
  90.  
  91.  
  92.  
  93.                   Table of Contents
  94.  
  95.  
  96.  
  97.     Chapter 1:  Introduction to CLX
  98.  
  99.     1.1.  Overview of the X Window System
  100.  
  101.     1.2.  Naming and Argument Conventions
  102.  
  103.     1.3.  Programming Considerations
  104.  
  105.     1.4.  Common Data Types
  106.  
  107.     1.5.  Complex Data Types
  108.  
  109.  
  110.     Chapter 2:  Displays
  111.  
  112.     2.1.  Opening the Display
  113.  
  114.     2.2.  Display Functions
  115.  
  116.     2.3.  Display Attributes
  117.  
  118.     2.3.1.  After-Function, Finish-Output, Force-Output 
  119.  
  120.     2.3.2.  Authorization-Data, Authorization-Name, and Display
  121.  
  122.     2.3.3.  Bitmap-Format and Pixmap-Formats
  123.  
  124.         2.3.4.  Byte-Order and Image-LSB-First-P
  125.  
  126.         2.3.5.  Default-Screen, NScreens, and Roots
  127.  
  128.         2.3.6.  Error-Handler
  129.  
  130.     2.3.7.  Error Conditions
  131.  
  132.         2.3.8.  Keycode-Range, Max-Keycode, and Min-Keycode
  133.  
  134.         2.3.9.  Max-Request-Length, Motion-Buffer-Size, and Squish
  135.  
  136.         2.3.10.  PList
  137.  
  138.         2.3.11. Protocol-Major-Version, Protocol-Minor-Version,
  139.                 Protocol-Version, Release-Number, Vendor, 
  140.                 Vendor-Name, and Version-Number
  141.  
  142.         2.3.11. Resource-ID-Base, Resource-ID-Mask, and XID
  143.  
  144.         2.3.12. XDefaults
  145.  
  146.         2.4.  Closing the Display
  147.  
  148.         2.5.  Connection Close Operations
  149.  
  150.  
  151.         Chapter 3:  Screens
  152.  
  153.         3.1.  Screen Functions
  154.  
  155.         3.2.  Screen Attributes
  156.  
  157.         3.2.1.  Backing-Stores and Save-Unders-P
  158.  
  159.         3.2.2.  Black-Pixel and White-Pixel
  160.  
  161.         3.2.3.  Default-Colormap, Max-Installed-Maps,
  162.                 and Min-Installed-Maps
  163.  
  164.         3.2.4.  Depths
  165.  
  166.         3.2.5.  Event-Mask-At-Open
  167.  
  168.         3.2.6.  Height, Height-In-Millimeters, Width,
  169.                 and Width-In-Millimeters
  170.  
  171.         3.2.7.  PList
  172.  
  173.         3.2.8.  Root, Root-Depth, and Root-Visual
  174.  
  175.  
  176.         Chapter 4:  Windows
  177.  
  178.         4.1.  Creating Windows
  179.  
  180.         4.2.  Obtaining Information About a Window
  181.  
  182.         4.3.  Window Configuration
  183.  
  184.         4.3.1.  Border-Width
  185.  
  186.         4.3.2.  X and Y Position
  187.  
  188.         4.3.3.  Width and Height
  189.  
  190.         4.3.4.  Depth
  191.  
  192.         4.3.5.  Stacking Priority
  193.  
  194.         4.4.  Window Attributes
  195.  
  196.         4.4.1.  Background
  197.  
  198.         4.4.2.  Border
  199.  
  200.         4.4.3.  Bit Gravity and Window Gravity
  201.  
  202.         4.4.4.  Backing-Store
  203.  
  204.         4.4.5.  Save-Under
  205.  
  206.         4.4.6.  Backing-Planes and Backing-Pixel
  207.  
  208.         4.4.7.  Event-Mask and Do-Not-Propagate-Mask
  209.  
  210.         4.4.8.  Override-Redirect
  211.  
  212.         4.4.10. Cursor
  213.  
  214.     4.4.11.    Font
  215.  
  216.     4.4.12. Atoms
  217.  
  218.         4.5.  Window Properties
  219.  
  220.         4.6.  Window Selections
  221.  
  222.         4.7.  Window Stacking Order
  223.  
  224.         4.8.  Window Hierarchy
  225.  
  226.         4.9.  Translating Window Coordinates
  227.  
  228.         4.10. Mapping Windows
  229.  
  230.         4.11. Unmapping Windows
  231.  
  232.         4.12. Destroying Windows
  233.  
  234.  
  235.         Chapter 5:  Graphic Contexts
  236.  
  237.         5.1.  Creating Graphic Contexts
  238.  
  239.         5.2.  Graphic Context Functions
  240.         
  241.         5.3.  Graphic Context Attributes
  242.  
  243.         5.3.1.  Arc-Mode
  244.  
  245.         5.3.2.  Background and Foreground
  246.  
  247.         5.3.3.  Cap-Style and Join-Style
  248.  
  249.         5.3.4.  Clip-Mask, Clip-Ordering, Clip-X, Clip-Y, and Subwindow-Mode
  250.  
  251.         5.3.5.  Dash-Offset, Dashes, and Line-Style
  252.  
  253.         5.3.6.  Exposures
  254.  
  255.         5.3.7.  Fill-Rule and Fill-Style
  256.  
  257.         5.3.8.  Font
  258.  
  259.         5.3.9.  Function and Plane-Mask
  260.  
  261.         5.3.10. Line-Width
  262.  
  263.         5.3.11. Stipple, Tile, TS-X, and TS-Y
  264.  
  265.         5.4.  Copying Graphic Contexts
  266.  
  267.         5.5.  Destroying Graphic Contexts
  268.  
  269.         5.6.  Graphic Context Cache
  270.  
  271.  
  272.  
  273.     Chapter 6:  Graphics Resource Functions
  274.  
  275.     6.1.  Colormaps and Colors
  276.  
  277.     6.1.1.  Color Functions
  278.  
  279.     6.1.2.  Color Cell Functions
  280.  
  281.     6.1.3.  Colormap Functions
  282.     
  283.     6.1.4  Color cells and planes
  284.  
  285.     6.2.  Manipulating Colors
  286.  
  287.     6.3.  Pixmaps
  288.  
  289. ****----preliminary section designations
  290.  
  291.     6.4. Manipulating Graphics Context/State 
  292.  
  293.     6.5. Using GC Convenience Routines 
  294.  
  295.     6.5.1. Setting the Foreground, Background, Plane Mask, or Function
  296.  
  297.     6.5.2. Setting the Line Attributes and Dashes
  298.  
  299.     6.5.3. Setting the Fill Style and File Rule
  300.  
  301.     6.5.4. Setting the Fill Tile and Stipple
  302.  
  303.     6.5.5. Setting the Current Font
  304.  
  305.     6.5.6. Setting the Clip Region
  306.  
  307.     6.5.7. Setting the Arc Mode, Subwindow Mode, and Graphics Exposure
  308.  
  309.  
  310.  
  311.         Chapter 7:  Graphic Operations
  312.  
  313.         7.1.  Area and Plane Operations
  314.  
  315.         7.2.  Drawing Points
  316.  
  317.         7.3.  Drawing Lines
  318.  
  319.         7.4.  Drawing Rectangles
  320.  
  321.         7.5.  Drawing Arcs
  322.  
  323.  
  324.       Chapter 8: Events and Event-Handling Functions ........  216
  325.  
  326. ****----preliminary section designations
  327.  
  328.       8.1. Event Types 
  329.  
  330.       8.2. Event Structures
  331.  
  332.       8.3. Event Mask
  333.  
  334.       8.4. Event Processing
  335.  
  336.       8.4.1. Keyboard and Pointer Event Processing
  337.  
  338.       8.4.2. Window Entry/Exit Event Processing
  339.  
  340.       8.4.3. Input Focus Events
  341.  
  342.       8.4.4. Key Map State Notification Event Processing
  343.  
  344.       8.4.5. Exposure Event Processing
  345.  
  346.       8.4.6. Window State Notification Event Processing
  347.  
  348.       8.4.7. Structure Control Event Processing
  349.  
  350.  
  351.       8.4.8. Color Map State Notification Event Processing
  352.  
  353.       8.4.9. Client Communication Event Processing
  354.  
  355.       8.5. Selecting Events
  356.  
  357.       8.6. Handling the Output Buffer
  358.  
  359.       8.7.  Event Queue Management
  360.  
  361.       8.8. Manipulating the Event Queue
  362.  
  363.       8.8.1. Returning the Next Event
  364.  
  365.       8.8.2. Selecting Events Using a Predicate Procedure
  366.  
  367.       8.8.3. Selecting Events Using a Window or Event Mask
  368.  
  369.       8.9. Putting an Event Back onto the Queue
  370.  
  371.       8.10. Sending Events to Other Applications
  372.  
  373.       8.11. Getting Pointer Motion History
  374.  
  375.       8.12. Handling Error Events
  376.  
  377.       8.12.1. Enabling or Disabling Synchronization
  378.  
  379.       8.12.2. Using the Default Error Handlers
  380.  
  381.  
  382.  
  383.  
  384.     Chapter 9: Window Manager Functions
  385.  
  386. ****----preliminary section designations
  387.  
  388.     9.1.  Changing the Parent
  389.  
  390.     9.2.  Lifetime of a Window
  391.  
  392.     9.3.  Resident Colormap Determination
  393.  
  394.     9.4.  Grab Operations
  395.  
  396.     9.4.1. Grabbing the pointer
  397.  
  398.     9.4.2. Grabbing a button
  399.  
  400.     9.4.3.  Grabbing the Keyboard
  401.  
  402.     9.4.4.  Grabbing a key
  403.  
  404.     9.4.5.  Grabbing the Server
  405.  
  406.     9.5.  Miscellaneous Control Functions
  407.  
  408.     9.6.  Keyboard Settings
  409.  
  410.     9.7.  Keyboard Encodings
  411.  
  412.     9.8. Screen Saver Utility
  413.  
  414.     9.9. Controlling Host Access
  415.  
  416.  
  417.  
  418.     Chapter ??:  Defining Extensions
  419.  
  420.  
  421.     Appendix
  422.  
  423.     Glossary of Terms
  424.  
  425.  
  426.       NOTE: all of the following LISP symbols are in the package XLIB.
  427.  
  428.  
  429.  
  430.                   Chapter 1
  431.  
  432.                  Introduction to CLX
  433.  
  434.  
  435. The X Window System is a network transparent window system that was designed
  436. at MIT and that runs under 4.3BSD UNIX, ULTRIX-32, many other UNIX variants,
  437. VAX/VMS, MS/DOS, as well as several other operating systems.
  438.  
  439. X display servers run on computers with either monochrome or color bitmap
  440. display hardware.  The server distributes user input to and accepts output
  441. requests from various client programs located either on the same machine or
  442. elsewhere in your network.  CLX is a Common LISP subroutine library that
  443. application programs (clients) use to interface with the window system by
  444. means of a stream connection.  Although a client often runs on the same
  445. machine as the X server it is talking to, this need not be the case.
  446.  
  447. This manual is a reference guide to the low-level Common LISP language
  448. interface to the X Window System protocol.  It is neither a tutorial nor a
  449. user guide to programming to the X Window System.  Other high-level
  450. abstractions (for example, the Common LISP User-Interface Environment, CLUE)
  451. are built on top of the CLX library.  For further information about these
  452. high-level libraries, see the appropriate documentation.  For general
  453. information about the design of X, see "The X Window System".  The X Window
  454. System Protocol provides the definitive word on the behavior of X.  So,
  455. while additional information is provided by this manual, the protocol
  456. document is the ruling document.
  457.  
  458. This manual assumes a basic understanding of a window system and of the
  459. Common LISP programming language.  To provide an introduction to CLX
  460. programming, this chapter discusses:
  461.  
  462. o    Overview of the X Window System
  463.  
  464. o    Naming and argument conventions
  465.  
  466. o    Programming considerations
  467.  
  468.  
  469. 1.1.  Overview of the X Window System
  470.  
  471. Some of the terms used in this book are unique to X, while other terms that
  472. are common to other window systems have different meanings in X.  You may
  473. find it helpful to refer to the glossary, located at the end of the book,
  474. when you are uncertain of a terms meaning in the context of the X Window
  475. System.
  476.  
  477. The X Window System supports one or more screens containing overlapping
  478. windows or subwindows.  A screen is a physical monitor and hardware, which
  479. may be either color or black and white.  There can be multiple screens per
  480. display or workstation.  A single server can provide display services for
  481. any number of screens.  A set of screens for a single user with one keyboard
  482. and one mouse is called a "display".
  483.  
  484. All the windows in an X server are arranged in a strict hierarchy.  At the
  485. top of the hierarchy are the root windows, which cover each of the display
  486. screens.  Each root window is partially or completely covered by child
  487. windows.  All windows, except for root windows, have parents.  There is
  488. usually at least one window per application program.  Child windows may in
  489. turn have their own children.  In this way, an application program can
  490. create a tree of arbitrary depth on each screen.
  491.  
  492. A child window may be larger than its parent.  That is, part or all of the
  493. child window may extend beyond the boundaries of the parent.  However, all
  494. output to a window is clipped by the boundaries of its parent window.  If
  495. several children of a window have overlapping locations, one of the children
  496. is considered to be on top of or raised over the others, obscuring them.
  497. Output to areas covered by other windows will be suppressed by the window
  498. system.  If a window is obscured by a second window, the second window will
  499. obscure only those ancestors of the second window, which are also ancestors
  500. of the first window.
  501.  
  502. A window has a border of zero or more pixels in width, which can be any
  503. pattern (pixmap) or solid color you like.  A window usually but not always
  504. has a background pattern which will be repainted by the window system when
  505. uncovered.  Each window has its own coordinate system.  Child windows
  506. obscure their parents unless the child windows have no background, and
  507. graphic operations in the parent window usually are clipped by the children.
  508.  
  509. Input from X takes the form of events.  Events may either be side effects of
  510. a command (for example, restacking windows generates exposure events) or
  511. completely asynchronous (for example, the keyboard).  A client program asks
  512. to be informed of events.  Programs must be prepared to handle (OR ignore)
  513. events of all types, because other applications can send events to your
  514. application.
  515.  
  516. X does not take responsibility for the contents of windows.  When part or
  517. all of a window is hidden and then brought back onto the screen, its
  518. contents may be lost, and the client program is notified (by an exposure
  519. event) that part or all of the window needs to be repainted.  Programs must
  520. be prepared to regenerate the contents of windows on demand.
  521.  
  522. X also provides off screen storage of graphics objects, called "pixmaps".
  523. Single plane (depth 1) pixmaps are sometimes referred to as "bitmaps".
  524. These can be used in most graphics functions interchangeably with windows,
  525. and are used in various graphic operations to define patterns also called
  526. "tiles".  Windows and pixmaps together are referred to as "drawables".
  527.  
  528. Most of the functions in CLX just add requests to an output buffer.  These
  529. requests later execute asynchronously on the X server, often referred to as
  530. display server.  Functions that return values of information stored in the
  531. server do not return (that is, they "block") until an explicit reply is
  532. received or an error occurs.  If a nonblocking call results in an error, the
  533. error will generally not be reported by a call to an optional error handler
  534. until some later, when a blocking call is made.
  535.  
  536. If it does not want a request to execute asynchronously, a client can follow
  537. it with a call to display-finish-output, which will block until all
  538. previously buffered asynchronous events have been sent and acted on.  As an
  539. important side effect, the output buffer is always flushed by a call to any
  540. function which returns a value from the server or waits for input (for
  541. example, get-property, process-event, or display-finish-output).
  542.  
  543. Many CLX functions will return an integer resource ID, which allows you to
  544. refer to objects stored on the X server.  These can be of type Window, Font,
  545. Pixmap, Bitmap, Cursor, and GContext.  These resources are created by user
  546. requests, and destroyed (OR freed) by user requests or when connections are
  547. closed.  Most of these resources are potentially sharable between
  548. applications, and in fact, windows are manipulated explicitly by window
  549. manager programs.  Fonts and cursors are typically shared automatically
  550. since the X server treats fonts specially, loading and unloading font
  551. storage as needed.  GContexts should not be shared between applications.
  552.  
  553. All errors (synchronous and asynchronous) are processed by calling an error
  554. handler in the display.  If the handler is a sequence it is expected to
  555. contain handler functions specific to each error.  The error code is used to
  556. index the sequence, fetching the appropriate handler.  Any results returned
  557. by the handler are ignored since it is assumed that the handler either takes
  558. care of the error completely, or else signals.
  559.  
  560. Input events (for example, key pressed or mouse moved) arrive asynchronously
  561. from the server and are queued until they are requested by an explicit call
  562. (for example, event-case or process-event).  In addition, some of the CLX
  563. functions (for example, SETF of some window attributes) generate exposure
  564. events (that is, requests to repaint sections of a window that do not have
  565. valid contents).  These events also arrive asynchronously, but the client
  566. may wish to explicitly wait for them by calling display-finish-output after
  567. calling a function which may generate exposure events.
  568.  
  569.  
  570. 1.2.  Naming and Argument Conventions
  571.  
  572. Throughout CLX, a number of conventions for naming and syntax of the CLX
  573. functions have been followed.  These conventions are intended to make the
  574. syntax of the functions more predictable, given that you remember what
  575. information the routine may require.
  576.  
  577. The major naming conventions are:
  578.  
  579. o    To better differentiate the CLX symbols from the other symbols they
  580.      have all been places in the package XLIB.  External symbols have been
  581.      explicitly exported.
  582.  
  583. o    The display argument, where used, is always first in the argument list.
  584.  
  585. o    All resource objects, where used, occur at the beginning of the
  586.      argument list, immediately after the display variable.
  587.  
  588. o    When a graphic context is present together with another type of
  589.      resource (most commonly, a drawable), the graphic context occurs in the
  590.      argument list after the other resource.  Drawables out rank all other
  591.      resources.
  592.  
  593. o    Source arguments always precede the destination arguments in the
  594.      argument list.
  595.  
  596. o    The x argument always precedes the y argument in the argument list.
  597.  
  598. o    The width argument always precedes the height argument in the argument
  599.      list.
  600.  
  601. o    Where the x, y, width and height arguments are used together, the x and
  602.      y arguments always precede the width and height arguments.
  603.  
  604. o    Where a mask is accompanied with a structure, the mask always precedes
  605.      the structure in the argument list.
  606.  
  607.  
  608. 1.3.  Programming Considerations
  609.  
  610. The major considerations are:
  611.  
  612. o    Keyboards are the greatest variable between different manufacturer's
  613.      workstations.  If you want your program to be portable, you should be
  614.      particularly conservative here.
  615.  
  616. o    Many display systems have limited amounts of off-screen memory.  If you
  617.      can, you should minimize use of pixmaps and backing store.
  618.  
  619. o    The user should have control of his screen real-estate.  Therefore, you
  620.      should write your applications to react to window management, rather
  621.      than presume control of the entire screen.  What you do inside of your
  622.      top level window, however, is up to your application.
  623.  
  624. o    Coordinates and sizes in X are actually 16-bit quantities.  They
  625.      usually are declared as an "int16" in the functions.  Values larger
  626.      than 16 bits may be truncated silently.  Sizes (width and height) are
  627.      unsigned quantities.
  628.  
  629. o    The types: color, colormap, cursor, display, font, gcontext, pixmap,
  630.      screen, and window are defined solely by a functional interface.  Even
  631.      though they are talked about as structures in this document, it is not
  632.      specified whether they are implemented as structures, flavors, or
  633.      whatever.  So, although functions below are written using DEFUN, this
  634.      is not an implementation requirement (it is a requirement that they be
  635.      functions as opposed to macros or special forms).
  636.  
  637.  
  638. 1.4. Common Data Types
  639.  
  640. The following are some data type definitions that are commonly used in CLX
  641. function definitions.
  642.  
  643.  
  644. (DEFTYPE alist (key-type-and-name datum-type-and-name) 'list)
  645.  
  646. The type alist defines an association list.  An association list is a
  647. sequence, containing zero or more repetitions of the given elements, with the
  648. elements expressed as (type name).
  649.  
  650.  
  651. (DEFTYPE angle () `(NUMBER ,(* -2 pi) ,(* 2 pi)))
  652.  
  653. The angle type is used to define an angle, in units of radians and is bounded
  654. by (* -2 pi) and (* 2 pi).  Note that we are explicitly using a different
  655. angle representation than what is actually transmitted in the protocol.
  656.  
  657.  
  658. (DEFTYPE arc-seq () '(repeat-seq
  659.             (int16 x) (int16 y) (card16 width) (card16 height)
  660.             (angle angle1) (angle angle2)))
  661.  
  662. The arc-seq type is used to define a six-tuple sequence of the form
  663. (X,Y,Width,Height,Angle1,Angle2).  The points X and Y are signed, 16-bit
  664. quantities with a range from -32,768 to 32,767.  The Width and Height values
  665. are unsigned, 16-bit quantities and range from 0 to 65,535.  Angle1 and Angle2
  666. in units of radians and bounded by (* -2 pi) and (* 2 pi).
  667.  
  668.  
  669. (DEFTYPE array-index () `(INTEGER 0 ,array-dimension-limit))
  670.  
  671. This defines a type which is a subtype of the integers and can be used to
  672. describe all variables that can be array indices.  The range is inclusive
  673. because start and end array index specifiers can be 1 past the end.
  674.  
  675.  
  676. (DEFTYPE boolean () '(OR null (NOT null)))
  677.  
  678. This defines a type which is all inclusive.  It is used for variables that
  679. can take on a true (non-null) or false (NIL) value.
  680.  
  681.  
  682. (DEFTYPE boole-constant ()
  683.   `(MEMBER ,BOOLE-CLR ,BOOLE-AND ,BOOLE-ANDC2 ,BOOLE-1
  684.            ,BOOLE-ANDC1 ,BOOLE-2 ,BOOLE-XOR ,BOOLE-IOR
  685.            ,BOOLE-NOR ,BOOLE-EQV ,BOOLE-C2 ,BOOLE-ORC2
  686.            ,BOOLE-C1 ,BOOLE-ORC1 ,BOOLE-NAND ,BOOLE-SET))
  687.  
  688. This defines a type which is a set of the values associated with the sixteen
  689. boolean operation-code constants for the Common LISP language.  It is used
  690. for the set of allowed source and destination combination functions in a
  691. graphic context.
  692.  
  693.  
  694. (DEFTYPE card8 () '(unsigned-byte 8))
  695.  
  696. The type card8 is an unsigned integer value that is a maximum of 8 bits
  697. long.  This gives a number of this type a range from 0 to 255.
  698.  
  699.  
  700. (DEFTYPE card16 () '(unsigned-byte 16))
  701.  
  702. The type card16 is an unsigned integer value that is a maximum of 16 bits
  703. long.  This gives a number of this type a range from 0 to 65,535.
  704.  
  705.  
  706. (DEFTYPE card29 () '(unsigned-byte 29))
  707.  
  708. The type card29 is an unsigned integer value that is a maximum of 29 bits
  709. long.  This gives a number of this type a range from 0 to 536,870,911.
  710.  
  711.  
  712. (DEFTYPE card32 () '(unsigned-byte 32))
  713.  
  714. The type card32 is an unsigned integer value that is a maximum of 32 bits
  715. long.  This gives a number of this type a range from 0 to 4,294,967,295.
  716.  
  717.  
  718. (DEFTYPE drawable () '(OR window pixmap))
  719.  
  720. Both windows and pixmaps may be used as sources and destinations in graphics
  721. operations.  These are collectively known as drawables.  However, an input
  722. only window cannot be used as a source or destination in a graphics
  723. operation.
  724.  
  725.  
  726. (DEFTYPE draw-direction ()
  727.   '(MEMBER :left-to-right :right-to-left))
  728.  
  729. The draw-direction type defines a list of rotation directions for drawing
  730. arcs and fonts.  Draw-direction may have the values of :left-to-right
  731. or :right-to-left.
  732.  
  733. (DEFTYPE error-key ()
  734.   '(MEMBER :access :alloc :atom :colormap :cursor :drawable :font :gcontext 
  735.        :id-choice :illegal-request :implementation :length :match :name
  736.        :pixmap :value :window))
  737.  
  738. All errors (synchronous and asynchronous) are processed by calling an error
  739. handler in the display.  The handler is called with the display as the first
  740. argument and the error-key as its second argument.  The error-key type defines
  741. a list of all predefined errors.
  742.  
  743.  
  744. (DEFTYPE event-key ()
  745.   '(MEMBER :key-press :key-release :button-press :button-release
  746.            :motion-notify :enter-notify :leave-notify :focus-in :focus-out
  747.            :keymap-notify :exposure :graphics-exposure :no-exposure
  748.            :visibility-notify :create-notify :destroy-notify :unmap-notify
  749.            :map-notify :map-request :reparent-notify :configure-notify
  750.            :gravity-notify :resize-request :configure-request
  751.            :circulate-notify :circulate-request :property-notify
  752.            :selection-clear :selection-request :selection-notify
  753.            :colormap-notify :client-message))
  754.  
  755. Clients are informed of information asynchronously by means of "events." These
  756. events may be either asynchronously generated from devices, or generated as
  757. side effects of client requests.  The event-key type defines a list that
  758. specifies all predefined event types.
  759.  
  760.  
  761. (DEFTYPE fontable () '(OR stringable font))
  762.  
  763. A fontable is either a font object or the name of one of the fonts in the
  764. font database.
  765.  
  766.  
  767. (DEFTYPE font-props () 'list)
  768.  
  769. The font-props type is a list which contains alternating keywords and
  770. integers.
  771.  
  772.  
  773. (DEFTYPE gcontext-key ()
  774.   '(MEMBER :function :plane-mask :foreground :background
  775.        :line-width :line-style :cap-style :join-style :fill-style :fill-rule
  776.        :arc-mode :tile :stipple :ts-x :ts-y :font :subwindow-mode
  777.        :exposures :clip-x :clip-y :clip-mask :dash-offset :dashes))
  778.  
  779. Various information for graphics output is stored in a "graphics context"
  780. ("GC" or "GContext"), such as foreground pixel, background pixel, line width,
  781. clipping region, etc.  The Gcontext-key type is a list of predefined types for
  782. use in gcontext processing.
  783.  
  784.  
  785. (DEFTYPE grab-status ()
  786.   '(member :success :already-grabbed :frozen :invalid-time :not-viewable))
  787.  
  788.  
  789. There are two kinds of grabs: active and passive.  An active grab occurs when
  790. a single client grabs the keyboard and/or pointer explicitly.  Clients can
  791. also grab a particular keyboard key or pointer button in a window.  The grab
  792. activates when the key or button is actually pressed, and is called a "passive
  793. grab".  Passive grabs can be very convenient for implementing reliable pop-up
  794. menus.
  795.  
  796.  
  797. (DEFTYPE image-depth () '(INTEGER 0 32))
  798.  
  799. The image-depth type is used in determining the depth of a pixmap, window or
  800. image.  The value specifies the number of bits "deep" that a given pixel has
  801. within a given pixmap, window or image.
  802.  
  803.  
  804. (DEFTYPE int8 () '(signed-byte 8))
  805.  
  806. The type int8 is an signed integer value that is a maximum of 8 bits long.
  807. This gives a number of this type a range from -128 to 127.
  808.  
  809.  
  810. (DEFTYPE int16 () '(signed-byte 16))
  811.  
  812. The type int16 is an signed integer value that is a maximum of 16 bits long.
  813. This gives a number of this type a range from -32,768 to 32,767.
  814.  
  815.  
  816. (DEFTYPE int32 () '(signed-byte 32))
  817.  
  818. The type int32 is an signed integer value that is a maximum of 32 bits long.
  819. This gives a number of this type a range from -2,147,483,648 to
  820. 2,147,483,647.
  821.  
  822.  
  823. (DEFTYPE keysym () 'card32)
  824.  
  825. The keysym type is used as an encoding of a symbol on a keycap on a keyboard.
  826. It is an unsigned integer value represented in a maximum of 32 bits long.
  827. This gives a keysym type a range from 0 to 4,294,967,295.
  828.  
  829.  
  830. (DEFTYPE mask16 () 'card16)
  831.  
  832. The type mask16 is a positional bitmask that contains 16 boolean flags.
  833.  
  834.  
  835. (DEFTYPE mask32 () 'card32)
  836.  
  837. The type mask32 is a positional bitmask that contains 32 boolean flags.
  838.  
  839.  
  840. (DEFTYPE modifier-key ()
  841.   '(MEMBER :shift :lock :control :mod-1 :mod-2 :mod-3 :mod-4 :mod-5) )
  842.  
  843. Shift, Control, Meta, Super, Hyper, Alt, Compose, Apple, CapsLock, ShiftLock,
  844. and similar keys are called modifier keys.  The modifier-key type is used to
  845. define these system dependent keys.  The modifier keys for shift, lock, and
  846. control are defined by the protocol, while the system dependent keys (:mod-1,
  847. mod-2, etc.) are defined by keyboard mapping routines.
  848.  
  849.  
  850. (DEFTYPE modifier-mask ()
  851.   '(OR (MEMBER :any) mask16 (list modifier-key)))
  852.  
  853. The modifier-mask type is used to define a 16-bit mask. The mask may be any of
  854. the modifier-key types, or :any.
  855.  
  856.  
  857. (DEFTYPE pixel () '(unsigned-byte 32))
  858.  
  859. The type pixel is an unsigned integer value that is a maximum of 32 bits long.
  860. This gives a pixel type a value range from 0 to 4,294,967,295.  Useful values
  861. are dependent on the class of colormap being used.
  862.  
  863.  
  864. (DEFTYPE point-seq () '(repeat-seq (int16 x) (int16 y)))
  865.  
  866. The point-seq type is used to define sequences of (X,Y) pairs of points.  The
  867. paired values are 16-bit, signed integer quantities.  This gives the points
  868. in this type a range from -32,768 to 32,767.
  869.  
  870.  
  871. (DEFTYPE rect-seq () '(repeat-seq (int16 x) (int16 y) 
  872.                   (card16 width) (card16 height)))
  873.  
  874. The rect-seq type is used to define a four-tuple sequence of the form
  875. (X,Y,Width,Height).  The points X, and Y are signed, 16-bit quantities with a
  876. range from -32,768 to 32,767.  The Width and Height values are unsigned,
  877. 16-bit quantities and range from 0 to 65,535.
  878.  
  879.  
  880. (DEFTYPE repeat-seq (&REST elts) 'sequence)
  881.  
  882. The repeat-seq type is a sub-type used to define repeating sequences.
  883.  
  884.  
  885. (DEFTYPE resource-id () 'card29)
  886.  
  887. The type resource-id is a numeric identifier that is assigned by the server
  888. to a resource object.
  889.  
  890.  
  891. (DEFTYPE rgb-val () '(FLOAT 0.0 1.0))
  892.  
  893. An rgb-val is a floating point value between 0 and 1 that specifies a
  894. saturation for a red, green, or blue additive primary.  The 0 value
  895. indicates no saturation and 1 indicates full saturation.
  896.  
  897.   
  898. (DEFTYPE seg-seq () '(repeat-seq (int16 x1) (int16 y1) (int16 x2) (int16 y2)))
  899.  
  900. The seg-seq type is used to define sequences of (X1,Y1,X2,Y2) sets of points.
  901. The point values are 16-bit, signed integer quantities.  This gives the
  902. points in this type a range from -32,768 to 32,767.
  903.  
  904.  
  905. (DEFTYPE state-mask-key ()
  906.   '(OR modifier-key (member :button-1 :button-2 :button-3 :button-4 :button-5)))
  907.  
  908. The state-mask-key type combines the modifier-key sub-type with the pointer
  909. buttons.
  910.  
  911.  
  912. (DEFTYPE stringable () '(OR STRING SYMBOL))
  913.  
  914. The type stringable is used for naming something.  It can be either a string
  915. or a symbol whose SYMBOL-NAME is used as the string containing the name.
  916. The case of the characters in the string is ignored when comparing
  917. stringables.
  918.  
  919.  
  920. (DEFTYPE timestamp () '(OR NULL card32))
  921.  
  922. The type timestamp is an encoding of a time.  NIL stands for the current
  923. time.
  924.  
  925.  
  926. (DEFTYPE xatom () '(OR STRING SYMBOL))
  927.  
  928. The type xatom is a name that has been assigned a corresponding unique id by
  929. the server.  They are used to identify properties, selections, and types.
  930. An xatom can be either a string or symbol whose SYMBOL-NAME is used as the
  931. string containing the name.  The case of the characters in the string are
  932. significant when comparing xatoms.
  933.  
  934. There are a number of xatoms that have predefined values.  These predefined
  935. xatoms are not strictly necessary, and may not be useful in all
  936. environments, but will eliminate many calls to intern-atom in most
  937. applications.  Note that "predefined" is only in the sense of having
  938. assigned id values, not in the sense of having required semantics.  The core
  939. protocol imposes no semantics on these names, except as they are used in
  940. FONTPROP structures (see query-font).
  941.  
  942. This is the list of predefined xatoms.  Remember that upper and lower case
  943. matters.
  944.  
  945.         ARC                     ITALIC_ANGLE            STRING
  946.         ATOM                    MAX_SPACE               SUBSCRIPT_X
  947.         BITMAP                  MIN_SPACE               SUBSCRIPT_Y
  948.         CAP_HEIGHT              NORM_SPACE              SUPERSCRIPT_X
  949.         CARDINAL                NOTICE                  SUPERSCRIPT_Y
  950.         COLORMAP                PIXMAP                  UNDERLINE_POSITION
  951.         COPYRIGHT               POINT                   UNDERLINE_THICKNESS
  952.         CURSOR                  POINT_SIZE              VISUALID
  953.         CUT_BUFFER0             PRIMARY                 WEIGHT
  954.         CUT_BUFFER1             QUAD_WIDTH              WINDOW
  955.         CUT_BUFFER2             RECTANGLE               WM_CLASS
  956.         CUT_BUFFER3             RESOLUTION              WM_CLIENT_MACHINE
  957.         CUT_BUFFER4             RESOURCE_MANAGER        WM_COMMAND
  958.         CUT_BUFFER5             RGB_BEST_MAP            WM_HINTS
  959.         CUT_BUFFER6             RGB_BLUE_MAP            WM_ICON_NAME
  960.         CUT_BUFFER7             RGB_COLOR_MAP           WM_ICON_SIZE
  961.         DRAWABLE                RGB_DEFAULT_MAP         WM_NAME
  962.         END_SPACE               RGB_GRAY_MAP            WM_NORMAL_HINTS
  963.         FAMILY_NAME             RGB_GREEN_MAP           WM_SIZE_HINTS
  964.         FONT                    RGB_RED_MAP             WM_TRANSIENT_FOR
  965.         FONT_NAME               SECONDARY               WM_ZOOM_HINTS
  966.         FULL_NAME               STRIKEOUT_ASCENT        X_HEIGHT
  967.         INTEGER                 STRIKEOUT_DESCENT
  968.  
  969. To avoid conflicts with possible future names for which semantics might be
  970. imposed (either at the protocol level or in terms of higher level user
  971. interface models), names beginning with an underscore should be used for
  972. xatoms that are private to a particular vendor or organization.  To
  973. guarantee no conflicts between vendors and organizations, additional
  974. prefixes need to be used, but the mechanism for choosing such prefixes is
  975. not defined here.  For names private to a single application or end user,
  976. but stored in "globally accessible" locations, it is suggested that two
  977. leading underscores be used to avoid conflicts with other names.
  978.  
  979.  
  980. 1.5. Complex Data Types
  981.  
  982. The following are some complex data type definitions that are used in CLX.
  983. The types: color, colormap, cursor, display, font, gcontext, pixmap, and
  984. window are defined solely by a functional interface.  It is not specified
  985. whether they are implemented as structures, flavors, or whatever.  So,
  986. although functions below are written using DEFUN, this is not an
  987. implementation requirement (it is a requirement that they be functions as
  988. opposed to macros or special forms).
  989.  
  990. The types: colormap, cursor, font, gcontext, pixmap, screen, and window are
  991. all represented as compound objects, rather than as integer resource-ids.
  992. This allows applications to deal with multiple displays without having an
  993. explicit display argument in the most common functions.  Every function uses
  994. the display object indicated by the first argument.  It is considered an error
  995. if arguments contain different displays, and predictable results are not
  996. guaranteed.
  997.  
  998. Each of colormap, cursor, font, gcontext, pixmap, and window have the
  999. following five functions associated with them:
  1000.  
  1001. (defun make-<mumble> (display resource-id)
  1002.   (declare (type display display)
  1003.        (type integer resource-id)
  1004.        (values <mumble>)))
  1005.  
  1006. (defun <mumble>-display (<mumble>)
  1007.   (declare (type <mumble> <mumble>)
  1008.        (values display)))
  1009.  
  1010. (defun <mumble>-id (<mumble>)
  1011.   (declare (type <mumble> <mumble>)
  1012.        (values integer)))
  1013.  
  1014. (defun <mumble>-equal (<mumble>-1 <mumble>-2)
  1015.   (declare (type <mumble> <mumble>-1 <mumble>-2)))
  1016.  
  1017. (defun <mumble>-p (<mumble>-1 <mumble>-2)
  1018.   (declare (type <mumble> <mumble>-1 <mumble>-2)
  1019.        (values boolean)))
  1020.  
  1021. This first function, make-<mumble>, should almost never be called by
  1022. applications, except possibly while handling events.  The other four routines:
  1023. -display, -id, -equal, and -p, are provided for user and are documented
  1024. individually, elsewhere in the body of this document.
  1025.  
  1026. (DEFTYPE color () '(SATISFIES color-p))
  1027.  
  1028. A color is a structure containing a triple of red, green, and blue values that
  1029. define a specific visible color.  It is a representation of a set of values
  1030. that could be stored in a color cell.  It contains all of the information
  1031. necessary to fully specify a specific visible color in a color cell.
  1032.  
  1033.  
  1034. (DEFTYPE colormap () '(SATISFIES colormap-p))
  1035.  
  1036. A colormap is an ordered collection of color cells.  For each possible value
  1037. a pixel may have on a display, there is a corresponding color cell in the
  1038. colormap.  For example, if a display is 4 bits deep there are entries for
  1039. pixel values from 0 through 15.
  1040.  
  1041.  
  1042. (DEFTYPE cursor () '(SATISFIES cursor-p))
  1043.  
  1044. A cursor is the visible shape of the (mouse) pointer on a screen.  The pointer
  1045. consists of a hot spot, a source bitmap, a shape bitmap, and a pair of colors.
  1046. The cursor, when defined for a given window, controls the visible appearance
  1047. of the pointer when the pointer is in that window.
  1048.  
  1049.  
  1050. (DEFTYPE display () '(SATISFIES display-p))
  1051.  
  1052. Applications should not directly modify any part of the display structure,
  1053. except where the elements are stated to be settable.  The other elements
  1054. should be considered read-only, although they may change as the result of
  1055. other operations on the display.
  1056.  
  1057.  
  1058. (DEFTYPE font () '(SATISFIES font-p))
  1059.  
  1060. A font is a matrix of glyphs (typically characters).  The protocol does no
  1061. translation or interpretation of character sets.  The client simply indicates
  1062. values used to index the glyph array.  A font contains additional metric
  1063. information to determine inter-glyph and inter-line spacing.
  1064.  
  1065.  
  1066. (DEFTYPE gcontext () '(SATISFIES gcontext-p))
  1067.  
  1068. Applications should not directly modify any part of the graphic context,
  1069. except where the elements are stated to be settable.  The other elements
  1070. should be considered read-only, although they may change as the result of
  1071. other operations on the graphic context.
  1072.  
  1073.  
  1074. (DEFTYPE pixmap () '(SATISFIES pixmap-p))
  1075.  
  1076. A pixmap is a three dimensional array of bits.  A pixmap is normally thought
  1077. of as a two dimensional array of pixels, where each pixel can be a value from
  1078. 0 to (2^N)-1, where N is the depth (z axis) of the pixmap.  A pixmap can also
  1079. be thought of as a stack of N bitmaps.
  1080.  
  1081.  
  1082. (DEFTYPE screen () '(SATISFIES screen-p))
  1083.  
  1084. Applications should not directly modify any part of the screen structure,
  1085. except where the elements are stated to be settable.  The elements should be
  1086. considered read-only, although they may change as the result of other
  1087. operations on the screen.
  1088.  
  1089.  
  1090. (DEFTYPE window () '(SATISFIES window-p))
  1091.  
  1092. Applications should not directly modify any part of the window structure,
  1093. except where the elements are stated to be settable.  The other elements
  1094. should be considered read-only, although they may change as the result of
  1095. other operations on the window.
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.                   Chapter 2
  1102.  
  1103.                                   Displays
  1104.  
  1105.  
  1106. A particular X server, together with its screens and input devices, is
  1107. called a display.  The CLX display structure contains all the information
  1108. about the particular display and its screens, as well as the state that is
  1109. needed to communicate with the display over a particular connection.
  1110.  
  1111. Before your program can use a display, you must establish a connection to
  1112. the X server driving your display.  Once you have established a connection,
  1113. you then can use the CLX macros and functions discussed in this chapter to
  1114. return information about the display.  This chapter discusses how to:
  1115.  
  1116. o    Open (connect) a display
  1117.  
  1118. o    Obtain information about a display
  1119.  
  1120. o    Access and change display attributes
  1121.  
  1122. o    Close (disconnect) a display
  1123.  
  1124. Finally, the chapter concludes with a section that describes the operations
  1125. that occur when the connection to the X server is closed.
  1126.  
  1127.  
  1128. 2.1.  Opening the Display
  1129.  
  1130. This section lists the Common LISP language functions and the data that they
  1131. require for opening a connection to an X server.
  1132.  
  1133.  
  1134. (DEFUN open-display (host &key (display 0) protocol)
  1135.   (DECLARE (TYPE integer :display)
  1136.            (VALUES display-structure)
  1137.            (TYPE display display-structure)))
  1138.  
  1139. host    Specifies the name of the host machine on which the display is
  1140.         physically attached.  A string must be acceptable as a host, but
  1141.         otherwise the possible types are not constrained, and will likely be
  1142.         very system dependent.
  1143.  
  1144. :display
  1145.         A keyword argument that specifies which screen on the host server
  1146.         for this connection should normally be used.  This is needed since
  1147.         multiple screens can be connected to or controlled by a single X
  1148.         server.  This argument is used to set an internal variable that can
  1149.         be accessed by using the display-default-screen function.  The
  1150.         default is to select screen zero.
  1151.  
  1152. :protocol
  1153.         A keyword argument that specifies the network protocol which should
  1154.         be used for connecting to the server (something like :TCP :DNA or
  1155.         :CHAOS).  The set of possible values and the default value are
  1156.         implementation specific.  Authorization, if any, is assumed to come
  1157.         from the environment somehow.
  1158.  
  1159. The open-display function returns a display structure that serves as the
  1160. connection to the X server and that contains all the information about that
  1161. X server.  Open-display connects the specified hardware display to the
  1162. server through TCP, UNIX domain, or DECnet stream communications protocols.
  1163. A single server can support any or all of these transport mechanisms
  1164. simultaneously.
  1165.  
  1166. After a successful call to open-display, all of the screens in the display
  1167. may be used by the client application.  The screen number specified in the
  1168. display argument will be returned by the display-default-screen function.
  1169. You can access elements of the display and screen structures by using the
  1170. accessor functions or macros.
  1171.  
  1172.  
  1173. 2.2.  Display Functions
  1174.  
  1175. CLX provides a number of useful functions that return data from a display
  1176. structure.  All other elements (that is, those for which no functions are
  1177. defined) are internal to CLX and must not be used.  An example of this is the
  1178. CLX No-Operation request.  The following lists the Common LISP language
  1179. functions and what data they return for the specified display structure.
  1180.  
  1181.  
  1182. (DEFUN display-p (display)
  1183.   (DECLARE (TYPE T display)
  1184.        (VALUES display?)
  1185.            (TYPE boolean display?)))
  1186.  
  1187. display The data object which is to be tested to see if it is a display.
  1188.  
  1189. This function returns non-null if the argument is a display structure,
  1190. otherwise it returns NIL.
  1191.  
  1192.  
  1193. (DEFUN colormap-display (colormap)
  1194.   (DECLARE (TYPE colormap colormap)
  1195.        (VALUES display?)
  1196.        (TYPE boolean display?)))
  1197.  
  1198. colormap
  1199.     Specifies the colormap whose display element is to be accessed.
  1200.  
  1201. This function returns the display that the specified colormap object is
  1202. associated with.
  1203.  
  1204.  
  1205. (DEFUN cursor-display (cursor)
  1206.    (DECLARE (TYPE cursor cursor)
  1207.             (VALUES display?)
  1208.             (TYPE boolean display?)))
  1209.  
  1210. cursor    The cursor object to be accessed.
  1211.  
  1212. This function returns the display that is associated with the specified cursor
  1213. object.
  1214.  
  1215.  
  1216. (DEFUN font-display (font)
  1217.    (DECLARE (TYPE font font)
  1218.         (VALUES display?)
  1219.             (TYPE boolean display?)))
  1220.  
  1221. font    The glyph array to be accessed.
  1222.  
  1223. This function returns the display that is associated with the specified font
  1224. object.
  1225.  
  1226.  
  1227. (DEFUN gcontext-display (gcontext)
  1228.   (DECLARE (TYPE gcontext gcontext)
  1229.            (VALUES display?)
  1230.            (TYPE display display?)))
  1231.  
  1232. gcontext
  1233.         The graphic context whose display is to be accessed.
  1234.  
  1235. This function returns the display that is associated with the specified
  1236. graphic context.
  1237.  
  1238.  
  1239. (DEFUN pixmap-display (pixmap)
  1240.    (DECLARE (TYPE pixmap pixmap)
  1241.         (VALUES display?)
  1242.             (TYPE boolean display?)))
  1243.  
  1244. pixmap    A three dimensional array of bits whose display is to be returned.
  1245.  
  1246. This function returns the display that is associated with the specified pixmap
  1247. object.
  1248.  
  1249.  
  1250. (DEFUN window-display (window)
  1251.   (DECLARE (TYPE window window)
  1252.            (VALUES display?)
  1253.            (TYPE display display?)))
  1254.  
  1255. window  The window structure which is to be accessed.
  1256.  
  1257. This function returns the display that is associated with the specified
  1258. window structure.
  1259.  
  1260.  
  1261. (DEFMACRO with-display ((display) &body body))
  1262.  
  1263. display The display structure which is to be accessed.
  1264.  
  1265.  
  1266. This macro is for use in a multi-process environment.  It provides exclusive
  1267. access to the local display object for multiple request generation.  It need
  1268. not provide immediate exclusive access for replies.  That is, if another
  1269. process is waiting for a reply (while not in a with-display), then
  1270. synchronization need not (but can) occur immediately.  Except where noted, all
  1271. routines effectively contain an implicit with-display where needed, so that
  1272. correct synchronization is always provided at the interface level on a
  1273. per-call basis.  Nested uses of this macro will work correctly.  This macro
  1274. does not prevent concurrent event processing (see with-event-queue).
  1275.  
  1276.  
  1277. 2.3.  Display Attributes
  1278.  
  1279. The complete set of display attributes are discussed in the following
  1280. sections.
  1281.  
  1282.  
  1283. 2.3.1.  After-Function, Finish-Output, Force-Output 
  1284.  
  1285.  
  1286. (DEFUN display-after-function (display)
  1287.   (DECLARE (TYPE display display)
  1288.            (VALUES after-function)
  1289.            (TYPE (OR NULL (FUNCTION (display))) after-function)))
  1290.  
  1291. Settable.
  1292.  
  1293. display The display structure which is to be accessed.
  1294.  
  1295. If this element is non-null it is a function that is called after every
  1296. protocol request is generated, even those inside an explicit with-display, but
  1297. never called from inside the after-function itself.  The function is called
  1298. inside the effective with-display for the associated request.  The default
  1299. value is NIL.  This can be set, for example, to #'display-force-output or
  1300. #'display-finish-output.
  1301.  
  1302.  
  1303. (DEFUN display-finish-output (display)
  1304.   (DECLARE (TYPE display display)))
  1305.  
  1306. display The display structure which is to be accessed.
  1307.  
  1308. Forces output, then causes a round-trip to ensure that all possible errors and
  1309. events have been received.
  1310.  
  1311.  
  1312. (DEFUN display-force-output (display)
  1313.   (DECLARE (TYPE display display)))
  1314.  
  1315. display The display structure which is to be accessed.
  1316.  
  1317. Output is normally buffered.  This function forces any buffered output to
  1318. occur.
  1319.  
  1320.  
  1321. 2.3.2.  Authorization-Data, Authorization-Name, and Display
  1322.  
  1323.  
  1324. (DEFUN display-authorization-data (display)
  1325.   (DECLARE (TYPE display display)
  1326.            (VALUES authorization-data)
  1327.            (TYPE string authorization-data)))
  1328.  
  1329. display The display structure which is to be accessed.
  1330.  
  1331. This functions returns the authorization data string that was transmitted to
  1332. the server during connection setup during the call to open-display.  The
  1333. data is specific to the particular authorization protocol that was used.
  1334. The display-authorization-name function returns the protocol used.
  1335.  
  1336.  
  1337. (DEFUN display-authorization-name (display)
  1338.   (DECLARE (TYPE display display)
  1339.            (VALUES authorization-name)
  1340.            (TYPE string authorization-name)))
  1341.  
  1342. display The display structure which is to be accessed.
  1343.  
  1344. This functions returns the authorization protocol name string that was
  1345. transmitted to the server during connection setup during the call to
  1346. open-display.  The authorization name indicates what authorization protocol
  1347. the client expects the server to use.  Specification of valid authorization
  1348. mechanisms is not part of the core X protocol.  It is hoped that eventually
  1349. one authorization protocol will be agreed upon.  In the mean time, a server
  1350. that implements a different protocol than the client expects, or a server
  1351. that only implements the host-based mechanism, may simply ignore this
  1352. information.  If both name and data strings are empty, this is to be
  1353. interpreted as "no explicit authorization".
  1354.  
  1355.  
  1356. (DEFUN display-display (display)
  1357.   (DECLARE (TYPE display display)
  1358.            (VALUES display-number)
  1359.            (TYPE integer display-number)))
  1360.  
  1361. display The display structure which is to be accessed.
  1362.  
  1363. Returns the display number for the host that was passed in the called to
  1364. open-display.
  1365.  
  1366.  
  1367. 2.3.3.  Bitmap-Format and Pixmap-Formats
  1368.  
  1369.  
  1370. (DEFUN display-bitmap-format (display)
  1371.   (DECLARE (TYPE display display)
  1372.            (VALUES bitmap-format?)
  1373.            (TYPE bitmap-format bitmap-format?)))
  1374.  
  1375. display The display structure which is to be accessed.
  1376.  
  1377. This function returns the bitmap-format structure that contains the bitmap
  1378. format information for the specified display.
  1379.  
  1380.  
  1381. (DEFUN display-pixmap-formats (display)
  1382.   (DECLARE (TYPE display display)
  1383.            (VALUES pixmap-formats)
  1384.            (TYPE list pixmap-formats)))
  1385.  
  1386. display The display structure which is to be accessed.
  1387.  
  1388. This function returns the list of pixmap formats that was returned from the
  1389. server during connection setup in a call to open-display.  This list
  1390. contains one entry for each depth value.  The entry describes the ZFormat
  1391. used to represent images of that depth.  An entry for a depth is included if
  1392. any screen supports that depth, and all screens supporting that depth must
  1393. support (only) that ZFormat for that depth.
  1394.  
  1395.  
  1396. 2.3.4.  Byte-Order and Image-LSB-First-P
  1397.  
  1398.  
  1399. (DEFUN display-byte-order (display)
  1400.   (DECLARE (TYPE display display)
  1401.            (VALUES byte-order)
  1402.            (TYPE (MEMBER :lsbfirst :msbfirst) byte-order)))
  1403.  
  1404. display The display structure which is to be accessed.
  1405.  
  1406. Returns the byte order to be employed in communication with the server.  The
  1407. possible values are :lsbfirst which means values are transmitted least
  1408. significant byte first, and :msbfirst which means values are transmitted
  1409. most significant byte first.  Except where explicitly noted in the protocol,
  1410. all 16-bit and 32-bit quantities sent by the client must be transmitted with
  1411. this byte order, and all 16-bit and 32-bit quantities returned by the server
  1412. will be transmitted with this byte order.
  1413.  
  1414.  
  1415. (DEFUN display-image-lsb-first-p (display)
  1416.   (DECLARE (TYPE display display)
  1417.            (VALUES image-lsb-first?)
  1418.            (TYPE boolean image-lsb-first?)))
  1419.  
  1420. display The display structure which is to be accessed.
  1421.  
  1422. Although the server is in general responsible for byte swapping data to
  1423. match the client, images are always transmitted and received in formats
  1424. (including byte order) specified by the server.  Within images for each
  1425. scanline unit in XYFormat images (bitmaps) or for each pixel value in
  1426. ZFormat images, the leftmost bit in the image as displayed on the screen is
  1427. either the least or most significant bit in the unit.  This function returns
  1428. non-null if it the least significant bit, otherwise it returns NIL.
  1429.  
  1430.  
  1431. 2.3.5.  Default-Screen, NScreens, and Roots
  1432.  
  1433.  
  1434. (DEFUN display-default-screen (display)
  1435.   (DECLARE (TYPE display display)
  1436.            (VALUES default-screen)
  1437.            (TYPE (OR NULL screen) default-screen)))
  1438.  
  1439. display The display structure which is to be accessed.
  1440.  
  1441. Returns the default screen specified in the argument to the open-display
  1442. function.  This function should be used to retrieve the screen in
  1443. applications that will use only a single screen.
  1444.  
  1445.  
  1446. (DEFUN display-nscreens (display)
  1447.   (DECLARE (TYPE display display)
  1448.            (VALUES number-of-screens)
  1449.            (TYPE card8 number-of-screens)))
  1450.  
  1451. display The display structure which is to be accessed.
  1452.  
  1453. This function returns the number of screens on this server.
  1454.  
  1455.  
  1456. (DEFUN display-roots (display)
  1457.   (DECLARE (TYPE display display)
  1458.            (VALUES roots)
  1459.            (TYPE (LIST screen) roots)))
  1460.  
  1461. display The display structure which is to be accessed.
  1462.  
  1463. This function returns a list of the screens structures available for the
  1464. server.
  1465.  
  1466.  
  1467. 2.3.6.  Error-Handler
  1468.  
  1469.  
  1470. (DEFUN display-error-handler (display)
  1471.   (DECLARE (TYPE display display)
  1472.            (VALUES error-handler)
  1473.            (TYPE (OR  (FUNCTION (display error &rest key-vals))
  1474.               (SEQUENCE (FUNCTION (display error &rest key-vals))))
  1475.                  error-handler)))
  1476.  
  1477. Settable.
  1478.  
  1479. display The display structure whose error-handler element is to be accessed.
  1480.  
  1481. All errors (synchronous and asynchronous) are processed by calling an error
  1482. handler specified in the error-handler element of the display structure.  If
  1483. the value of this element is a sequence it is expected to contain a handler
  1484. function for each specific error.  The error code is used as an index into
  1485. the sequence to fetch the appropriate handler function.  If this element is
  1486. a function it is called for all errors.  Any results returned by the handler
  1487. are ignored, since it is assumed the handler either takes care of the error
  1488. completely, or else signals.  The arguments passed to the handler function
  1489. are the display object, a symbol naming the type of error, and a set of
  1490. keyword-value arguments pairs which vary depending on the type of error.
  1491. For all core errors, the keyword-value argument pairs are:
  1492.  
  1493.         :current-sequence       card16
  1494.         :major                  card8
  1495.         :minor                  card16
  1496.         :sequence               card16
  1497.  
  1498. For colormap, cursor, drawable, font, gcontext, id-choice, pixmap, and
  1499. window errors the keyword-value pairs are the core error pairs plus:
  1500.  
  1501.         :resource-id            card32
  1502.  
  1503. For :atom errors the keyword-value pairs are the core error pairs plus:
  1504.  
  1505.         :atom-id                card32
  1506.  
  1507. For :value errors the keyword-value pairs are the core error pairs plus:
  1508.  
  1509.         :value                  card32
  1510.  
  1511. 2.3.7.  Error Conditions
  1512.  
  1513. CLX errors are usually displayed using the default error handler. However,
  1514. the user has the option of redefining the default error handler for any given
  1515. display. The user can do this by modifying  the display structure's
  1516. error-handler slot. The replacement must be an executable function whose
  1517. formal parameters match those of the default handler. 
  1518.  
  1519.  
  1520. (DEFMACRO define-condition (name (base) &body &optional items) 
  1521.   )
  1522.  
  1523. name    The name of the condition being defined.
  1524.  
  1525. base    The parent type of the condition; ex: resource-error.
  1526.  
  1527. items    An association list of condition related items; either (:documentation 
  1528.     doc-string), (:conc-name symbol-or-string) or (:report exp).
  1529.  
  1530.  
  1531. Define-condition defines a new condition type called name, which is a subtype
  1532. of the parent-type, base.  Except as otherwise noted, the arguments are not
  1533. evaluated.  Items are of the form: (:documentation doc-string), (:conc-name
  1534. symbol-or-string) or (:report exp).  When using the :documentation item,
  1535. doc-string should be a string which describes the purpose of the condition
  1536. type or NIL.  If this option is omitted, NIL is assumed.  When using the
  1537. :conc-name item, symbol-or-string sets up automatic prefixing of the names of
  1538. slot accessors.  If no :conc-name option is specified, the name of the new
  1539. condition type is followed by a hyphen will be used instead.  Conc-name is
  1540. interned in the package which is current at the time that the define-condition
  1541. is processed.  
  1542.  
  1543. The :report item option defines a function which describes the condition type.
  1544. If exp is a literal string, it is a shorthand for (Lambda (Condition stream)
  1545. (Write-String exp stream)) If exp is not a literal string, it must be a
  1546. suitable argument to the special form, Function.  The expression (FUNCTION
  1547. exp) will be evaluated in the current lexical environment.  It should return a
  1548. function of two arguments, a condition and a stream, which prints on the
  1549. stream a description of the condition.  The :report option is processed after
  1550. the new condition type has been defined, so use of the slot accessors within
  1551. the report function is permitted.  If this option is not specified,
  1552. information about how to report this type of condition will be inherited from
  1553. the PARENT-TYPE.  See the CLEH reference manual for further information
  1554. regarding define-condition.
  1555.  
  1556.  
  1557. For example, the condition request-error (which is used as a parent-type for
  1558. defining other conditions) is defined by using the function define-condition.
  1559. The condition request-error makes use of the parent-type x-error.  The list
  1560. (display error-key major minor sequence current-sequence) defines accessor
  1561. slots that are described in the CLEH documentation.  The items list contains
  1562. only the :report option.
  1563.  
  1564.  
  1565.  
  1566.  
  1567. (define-condition access-error (request-error))
  1568.  
  1569. An access-error can occur for several reasons: A client attempted to grab a
  1570. key/button combination already grabbed by another client.  A client attempted
  1571. to free a color map entry that it did not already allocate.  A client
  1572. attempted to store into a read-only color map entry.  A client attempted to
  1573. modify the access control list from other than the local (or otherwise
  1574. authorized) host.  A client attempted to select an event type that another
  1575. client has already selected, and, that at most, one client can select at a
  1576. time.
  1577.  
  1578.  
  1579. (define-condition alloc-error (request-error))
  1580.  
  1581. The server failed to allocate the requested resource or server memory.
  1582.  
  1583.  
  1584. (define-condition atom-error (request-error)
  1585.   atom-id)
  1586.  
  1587. A value for an Atom argument does not name a defined Atom.
  1588.  
  1589.    
  1590. (define-condition closed-display (x-error)
  1591.   display)
  1592.  
  1593. The closed-display condition is signaled when trying to read or write a closed
  1594. display (i.e.  close-display has been called on the display object, or a
  1595. server-disconnect occurred).
  1596.  
  1597.  
  1598. (define-condition colormap-error (resource-error))
  1599.  
  1600. A value for a Colormap argument does not name a defined Colormap.
  1601.  
  1602.  
  1603. (define-condition connection-failure (x-error)
  1604.   (major-version
  1605.    minor-version
  1606.    host
  1607.    display
  1608.    reason))
  1609.  
  1610. Signaled when an X11 server refuses a connection.
  1611.  
  1612.  
  1613. (define-condition cursor-error (resource-error))
  1614.  
  1615. A value for a Cursor argument does not name a defined Cursor.
  1616.  
  1617. (define-condition device-busy (x-error)
  1618.   display)
  1619.  
  1620. Signaled by (setf (pointer-mapping display) mapping) when the
  1621. Set-Pointer-Mapping request returns a busy status.  A similar condition occurs
  1622. in set-modifier-mapping, but in this case, it returns a boolean indicating
  1623. success, rather than signaling an error.
  1624.  
  1625.  
  1626. (define-condition drawable-error (resource-error))
  1627.  
  1628. A value for a Drawable argument does not name a defined Window or Pixmap.
  1629.  
  1630.  
  1631. (define-condition font-error (resource-error))
  1632.  
  1633. A value for a Font or GContext argument does not name a defined Font.
  1634.  
  1635.  
  1636. (define-condition gcontext-error (resource-error))
  1637.  
  1638. A value for a GContext argument does not name a defined GContext.
  1639.  
  1640.  
  1641. (define-condition id-choice-error (resource-error))
  1642.  
  1643. The value chosen for a resource identifier is either not included in the range
  1644. assigned to the client or is already in use.  Under normal circumstances this
  1645. cannot occur and should be considered a server or CLX Library error.
  1646.  
  1647.  
  1648. (define-condition implementation-error (request-error))
  1649.  
  1650. The server does not implement some aspect of the request.  A server that
  1651. generates this error for a core request is deficient.  As such, this error is
  1652. not listed for any of the requests.  However, clients should be prepared to
  1653. receive such errors and either handle or discard them.
  1654.  
  1655.  
  1656. (define-condition length-error (request-error))
  1657.  
  1658. The length of a request is shorter or longer than that minimally required to
  1659. contain the arguments.  This usually means an internal CLX error.
  1660.  
  1661.  
  1662. (define-condition lookup-error (x-error)
  1663.   (id display type object)
  1664.  
  1665. CLX has the option of caching different resource types (see
  1666. *clx-cached-types*) in a hash table by resource-id.  When looking up an object
  1667. in the hash table, if the type of the object is wrong, a lookup-error is
  1668. signaled.  For example: The cursor with id 123 is interned in the hash table.
  1669. An event is received with a field for window 123.  When 123 is looked up in
  1670. the hash table, a cursor is found.  Since a window was expected, a
  1671. lookup-error is signaled.  This error should never occur unless buggy
  1672. extension code is being used.
  1673.  
  1674.  
  1675. (define-condition match-error (request-error))
  1676.  
  1677. In a graphics request, the root and depth of the GContext does not match that
  1678. of the drawable.  An input-only window is used as a Drawable.  Some argument
  1679. or pair of arguments has the correct type and range but fails to match in some
  1680. other way required by the request.  An input-only window locks this attribute.
  1681. The values do not exist for an input-only window.
  1682.  
  1683. (define-condition missing-parameter (x-error)
  1684.   parameter)
  1685.  
  1686. One or more of the required keyword parameter(s) is missing or NIL.
  1687.  
  1688.  
  1689. (define-condition name-error (request-error))
  1690.  
  1691. A font or color of the specified name does not exist.
  1692.  
  1693.  
  1694. (define-condition pixmap-error (resource-error))
  1695.  
  1696. A value for a Pixmap argument does not name a defined Pixmap.
  1697.  
  1698.  
  1699. (define-condition reply-length-error (x-error)
  1700.   (reply-length
  1701.    expected-length
  1702.    display))
  1703.  
  1704. The reply to a request has an unexpected length.  
  1705.  
  1706.  
  1707. (define-condition reply-timeout (x-error)
  1708.   (timeout
  1709.    display))
  1710.  
  1711. The *reply-timeout* parameter specifies the maximum number of seconds to wait
  1712. for a request reply, or NIL to wait forever (the default).  When a reply
  1713. hasn't been received after *reply-timeout* seconds, the reply-timeout
  1714. condition is signaled.
  1715.  
  1716.  
  1717. (define-condition request-error (x-error)
  1718.   (display
  1719.    error-key
  1720.    major
  1721.    minor
  1722.    sequence
  1723.    current-sequence))
  1724.  
  1725. The major or minor opcode does not specify a valid request.
  1726.  
  1727.  
  1728. (define-condition resource-error (request-error)
  1729.   (resource-id))
  1730.  
  1731. Conditions are built in a hierarchy.  All CLX errors are built on top of the
  1732. x-error condition.  (what x-error is built on is implementation dependent, but
  1733. it's probably based on the ERROR condition.) resource-error is built on top of
  1734. x-error.  All X11 errors for incorrect resource id's are built on top of
  1735. resource-error.  These are colormap-error, cursor-error, drawable-error,
  1736. font-error, gcontext-error, id-choice-error, pixmap-error and window-error.
  1737. resource-error is never signaled directly.
  1738.  
  1739.  
  1740. (define-condition sequence-error (x-error)
  1741.   (display
  1742.    req-sequence
  1743.    msg-sequence))
  1744.  
  1745. All X11 request replies contain the sequence number of their request.  If a
  1746. replies sequence doesn't match the request count, a sequence-error is
  1747. signaled.  Sequence-error's usually indicate a locking problem with a
  1748. multi-processing lisp.
  1749.     
  1750.  
  1751. (define-condition server-disconnect (x-error)
  1752.   (display))
  1753.  
  1754. The connection to the server was lost.
  1755.  
  1756.  
  1757. (define-condition unexpected-reply (x-error)
  1758.   (display
  1759.    msg-sequence
  1760.    req-sequence
  1761.    length))
  1762.  
  1763. A reply was found when none was expected.  This should only occur when using
  1764. buggy extension code.
  1765.  
  1766.  
  1767. (define-condition unknown-error (request-error)
  1768.   (error-code))
  1769.  
  1770. An error was received from the server with an unknown error code.  This is
  1771. most probably caused by buggy extension code.
  1772.  
  1773. (define-condition value-error (request-error)
  1774.   (value))
  1775.  
  1776. Some numeric value falls outside the range of values accepted by the request.
  1777. Unless a specific range is specified for an argument, the full range defined
  1778. by the argument's type is accepted.  Any argument defined as a set of
  1779. alternatives can generate this error.
  1780.  
  1781. (define-condition window-error resource-error)
  1782.  
  1783. A value for a Window argument does not name a defined Window.
  1784.  
  1785.  
  1786. 2.3.8.  Keycode-Range, Max-Keycode, and Min-Keycode
  1787.  
  1788.  
  1789. (DEFUN display-keycode-range (display)
  1790.   (DECLARE (TYPE display display)
  1791.            (VALUES min-keycode max-keycode)
  1792.            (TYPE card8 min-keycode max-keycode)))
  1793.  
  1794. display The display structure which is to be accessed.
  1795.  
  1796. Returns display-min-keycode and display-max-keycode as multiple values.
  1797.  
  1798.  
  1799. (DEFUN display-max-keycode (display)
  1800.   (DECLARE (TYPE display display)
  1801.            (VALUES max-keycode)
  1802.            (TYPE card8 max-keycode)))
  1803.  
  1804. display The display structure which is to be accessed.
  1805.  
  1806. This function returns the maximum keycode value transmitted by the server.
  1807. This value is never greater than 255.  Not all keycodes in the allowed range
  1808. are required to have corresponding keys.
  1809.  
  1810.  
  1811. (DEFUN display-min-keycode (display)
  1812.   (DECLARE (TYPE display display)
  1813.            (VALUES min-keycode)
  1814.            (TYPE card8 min-keycode)))
  1815.  
  1816. display The display structure which is to be accessed.
  1817.  
  1818. This function returns the minimum keycode value transmitted by the server.
  1819. This value is never less than 8.  Not all keycodes in the allowed range are
  1820. required to have corresponding keys.
  1821.  
  1822.  
  1823. 2.3.9.  Max-Request-Length, Motion-Buffer-Size, and Squish
  1824.  
  1825.  
  1826. (DEFUN display-max-request-length (display)
  1827.   (DECLARE (TYPE display display)
  1828.            (VALUES max-request-length)
  1829.            (TYPE card16 max-request-length)))
  1830.  
  1831. display The display structure which is to be accessed.
  1832.  
  1833. This function returns the maximum length of a request, in 4-byte units, that
  1834. is accepted by the server.  Requests larger than this generate a length
  1835. error, and the server will read and simply discard the entire request.  This
  1836. length will always be at least 4096 (i.e., requests of length up to and
  1837. including 16384 bytes will be accepted by all servers).
  1838.  
  1839.  
  1840. (DEFUN display-motion-buffer-size (display)
  1841.   (DECLARE (TYPE display display)
  1842.            (VALUES motion-buffer-size)
  1843.            (TYPE card32 motion-buffer-size)))
  1844.  
  1845. display The display structure which is to be accessed.
  1846.  
  1847. This function returns the approximate size of motion buffer in the server.
  1848. The server may retain the recent history of pointer motion, and to a finer
  1849. granularity than is reported by motion-notify events.  Such history is
  1850. available via the motion-events function.
  1851.  
  1852.  
  1853. (DEFUN display-squish (display)
  1854.   (DECLARE (TYPE display display)
  1855.            (VALUES squish-mouse-move-event?)
  1856.            (TYPE boolean squish-mouse-move-event?)))
  1857.  
  1858. display The display structure which is to be accessed.
  1859.  
  1860. This function returns non-null if this server squishes mouse-moved events,
  1861. otherwise it returns NIL.
  1862.  
  1863.  
  1864. 2.3.10.  Plist
  1865.  
  1866.  
  1867. (DEFUN display-plist (display)
  1868.   (DECLARE (TYPE display display)
  1869.            (VALUES plist)
  1870.            (TYPE list plist))))
  1871.  
  1872. display The display structure which is to be accessed.
  1873.  
  1874. This returns the property list for the specified display.  This is a hook for
  1875. extensions to hang data on.
  1876.  
  1877.  
  1878. 2.3.11.  Protocol-Major-Version, Protocol-Minor-Version, Protocol-Version,
  1879.          Release-Number, Vendor, Vendor-Name, and Version-Number
  1880.  
  1881.  
  1882. (DEFUN display-protocol-major-version (display)
  1883.   (DECLARE (TYPE display display)
  1884.            (VALUES protocol-major-version)
  1885.            (TYPE card16 protocol-major-version)))
  1886.  
  1887. display The display structure which is to be accessed.
  1888.  
  1889. Returns the major version number of the X protocol associated with the X
  1890. server.  In general, the major version would increment for incompatible
  1891. changes.  The protocol version number returned indicate the protocol the
  1892. server actually supports.  This might not equal the version supported by the
  1893. client.  The server can (but need not) refuse connections from clients that
  1894. offer a different version than the server supports.  A server can (but need
  1895. not) support more than one version simultaneously.
  1896.  
  1897.  
  1898. (DEFUN display-protocol-minor-version (display)
  1899.   (DECLARE (TYPE display display)
  1900.            (VALUES protocol-minor-version)
  1901.            (TYPE card16 protocol-minor-version)))
  1902.  
  1903. display The display structure which is to be accessed.
  1904.  
  1905. Returns the minor protocol revision number associated with the X server.  In
  1906. general, the minor version would increment for small upward compatible changes
  1907. in the X protocol.
  1908.  
  1909.  
  1910. (DEFUN display-protocol-version (display)
  1911.   (DECLARE (TYPE display display)
  1912.            (VALUES protocol-major-version protocol-minor-version)
  1913.            (TYPE card16 protocol-major-version protocol-minor-version)))
  1914.  
  1915. display The display structure which is to be accessed.
  1916.  
  1917. Returns display-protocol-major-version and display-protocol-minor-version as
  1918. multiple values.
  1919.  
  1920.  
  1921. (DEFUN display-release-number (display)
  1922.   (DECLARE (TYPE display display)
  1923.            (VALUES release-number)
  1924.            (TYPE card32 release-number)))
  1925.  
  1926. display The display structure which is to be accessed.
  1927.  
  1928. Return a number related to a vendor's release of the X server.  The
  1929. semantics of the release-number is controlled by the vendor.
  1930.  
  1931.  
  1932. (DEFUN display-vendor (display)
  1933.   (DECLARE (TYPE display display)
  1934.            (VALUES vendor-name release-number)
  1935.            (TYPE string vendor-name)
  1936.            (TYPE card32 release-number)))
  1937.  
  1938. display The display structure which is to be accessed.
  1939.  
  1940. Returns display-vendor-name and display-release-number as multiple values.
  1941.  
  1942.  
  1943. (DEFUN display-vendor-name (display)
  1944.   (DECLARE (TYPE display display)
  1945.            (VALUES vendor-name)
  1946.            (TYPE string vendor-name)))
  1947.  
  1948. display The display structure which is to be accessed.
  1949.  
  1950. Return a string that provides some identification of the vendor of the X
  1951. server implementation.
  1952.  
  1953.  
  1954. (DEFUN display-version-number (display)
  1955.   (DECLARE (TYPE display display)
  1956.            (VALUES version-number)
  1957.            (TYPE card16 version-number)))
  1958.  
  1959. display The display structure which is to be accessed.
  1960.  
  1961. This function returns the X protocol version number for this implementation
  1962. of CLX.
  1963.  
  1964.  
  1965. 2.3.11.  Resource-ID-Base, Resource-ID-Mask, and XID
  1966.  
  1967.  
  1968. (DEFUN display-resource-id-base (display)
  1969.   (DECLARE (TYPE display display)
  1970.            (VALUES resource-id-base)
  1971.            (TYPE resource-id resource-id-base)))
  1972.  
  1973. display The display structure which is to be accessed.
  1974.  
  1975. This function returns the resource id base value that was returned from the
  1976. server during connection setup in a call to open-display.  This is used in
  1977. combination with the resource id mask to construct valid ids for this
  1978. connection.
  1979.  
  1980.  
  1981. (DEFUN display-resource-id-mask (display)
  1982.   (DECLARE (TYPE display display)
  1983.            (VALUES resource-id-mask)
  1984.            (TYPE resource-id resource-id-mask)))
  1985.  
  1986. display The display structure which is to be accessed.
  1987.  
  1988. This function returns the resource id mask that was returned from the server
  1989. during connection setup in a call to open-display.  The resource id mask
  1990. contains a single contiguous set of bits (at least 18) which the client uses
  1991. to allocate resource ids for types window, pixmap, cursor, font, gcontext,
  1992. and colormap by choosing a value with (only) some subset of these bits set,
  1993. and oring it with the resource id base.  Only values constructed in this way
  1994. can be used to name newly created resources over this connection.  Resource
  1995. ids never have the top 3 bits set.  The client is not restricted to linear
  1996. or contiguous allocation of resource ids.  Once an id has been freed, it can
  1997. be reused, but this should not be necessary.  An id must be unique with
  1998. respect to the ids of all other resources, not just other resources of the
  1999. same type.  However, note that the value spaces of resource identifiers,
  2000. atoms, visualids, and keysyms are distinguished by context, and as such are
  2001. not required to be disjoint (e.g., a given numeric value might be both a
  2002. valid window id, a valid atom, and a valid keysym.)
  2003.  
  2004.  
  2005. (DEFUN display-xid (display)
  2006.   (DECLARE (TYPE display display)
  2007.            (VALUES resource-allocator)
  2008.            (TYPE #'function resource-allocator)))
  2009.  
  2010. display The display structure which is to be accessed.
  2011.  
  2012. This function returns the function that is used to allocate resource ids for
  2013. this display.
  2014.  
  2015.  
  2016. 2.3.12.  XDefaults
  2017.  
  2018.  
  2019. (DEFUN display-xdefaults (display)
  2020.   (DECLARE (TYPE display display)
  2021.            (VALUES x-defaults)
  2022.            (TYPE ?? x-defaults)))
  2023.  
  2024. display The display structure which is to be accessed.
  2025.  
  2026. This function returns the contents of the defaults from the server.  This
  2027. provides a simple interface for clients not wishing to use a toolkit or the
  2028. more elaborate interfaces provided by the resource manager.  The data
  2029. returned by display-xdefaults are owned by CLX and should not be modified or
  2030. freed by the client.
  2031.  
  2032.  
  2033. 2.4.  Closing the Display
  2034.  
  2035. To close or disconnect a display from the X server, use close-display.
  2036.  
  2037.  
  2038. (DEFUN close-display (display)
  2039.   (DECLARE (TYPE display display)))
  2040.  
  2041. display The display structure which is to be accessed.
  2042.  
  2043. This function closes the connection to the X server for the specified
  2044. display.  It destroys all windows, resource ids (window, font, pixmap,
  2045. colormap, cursor, and gcontext), and other resources (gcontexts) that the
  2046. client application has created on this display, unless the close down mode of
  2047. the resource has been changed (see set-close-down-mode).  Therefore, these
  2048. windows, resource ids, and other resources should never be referenced again.
  2049. In addition, this function discards any output requests that have been
  2050. buffered but have not yet been sent.
  2051.  
  2052.  
  2053. 2.5.  X Server Connection Close Operations
  2054.  
  2055. When the X servers connection to a client is closed, either by an explicit
  2056. call to close-display or by some indirect effect, the X server performs
  2057. these automatic operations:
  2058.  
  2059. o    All selections (see set-selection-owner) owned by the client are
  2060.      disowned.
  2061.  
  2062. o    Performs an ungrab-pointer and ungrab-keyboard if the client
  2063.      application has actively grabbed the pointer or the keyboard.
  2064.  
  2065. o    Performs an ungrab-server if the client has grabbed the server.
  2066.  
  2067. o    Releases all passive grabs made by the client application.
  2068.  
  2069. o    Marks all resources (including colormap entries) allocated by the
  2070.      client application either as permanent or temporary, depending on
  2071.      whether the close-down mode argument is either :retain-permanent or
  2072.      :retain-temporary.  However, this does not prevent other client
  2073.      applications from explicitly destroying the resources.
  2074.  
  2075. When the close-down mode is :destroy, the X server destroys all of a client
  2076. application's resources as follows:
  2077.  
  2078. o    Examines each window in the client's save-set to determine if it is an
  2079.      inferior (subwindow) of a window created by the client.  (The save-set
  2080.      is a list of other clients windows, and windows in this list are
  2081.      referred to as a save-set window.) If so, the X server reparents the
  2082.      save-set window to the closest ancestor such that the save-set window
  2083.      is not an inferior of a window created by the client.
  2084.  
  2085. o    Performs a map-window on the save-set window if the save-set window is
  2086.      unmapped.  The X server does this even if the save-set window was not
  2087.      an inferior of a window created by the client.
  2088.  
  2089. o    Examines each window in the client's save-set, and destroys all windows
  2090.      created by the client.
  2091.  
  2092. o    Performs the appropriate free request on each non-window resource
  2093.      created by the client in the server (for example, font, pixmap, cursor,
  2094.      colormap, and gcontext).
  2095.  
  2096. o    Frees all colors and colormap entries allocated by a client
  2097.      application.
  2098.  
  2099. Additional processing occurs when the last connection to the X server
  2100. closes.  An X server goes through a cycle of having no connections and
  2101. having some connections.  When the last connection to the X server closes as
  2102. a result of a connection closing with the close-down mode of :destroy (that
  2103. is, the X server reverts to the state of having no connections), the X
  2104. server:
  2105.  
  2106. o    Resets its state, as if it had just been started.  The X server begins
  2107.      by destroying all lingering resources from clients that have terminated
  2108.      in :retain-permanent or :retain-temporary mode.
  2109.  
  2110. o    Deletes all but the predefined atom identifiers.
  2111.  
  2112. o    Deletes all properties on all root windows.
  2113.  
  2114. o    Resets all device maps and attributes (for example, key click, bell
  2115.      volume, and acceleration) and the access control list.
  2116.  
  2117. o    Restores the standard root tiles and cursors.
  2118.  
  2119. o    Restores the default font path.
  2120.  
  2121. o    Restores the input focus to state :pointer-root.
  2122.  
  2123. However, the X server does not reset if you close a connection with a
  2124. close-down mode of :retain-permanent or :retain-temporary.
  2125.  
  2126.  
  2127.  
  2128.                                   Chapter 3
  2129.  
  2130.                                    Screens
  2131.  
  2132.  
  2133. 3.1.  Screen Functions
  2134.  
  2135. The following lists the Common LISP language functions and what data they
  2136. return for the specified screen structure.
  2137.  
  2138.  
  2139. (DEFUN screen-p (screen)
  2140.   (DECLARE (TYPE T screen)
  2141.            (VALUES screen?)
  2142.            (TYPE boolean screen?)))
  2143.  
  2144. screen  The screen structure which is to be accessed.
  2145.  
  2146. This function returns non-null if the screen argument is a screen structure,
  2147. otherwise it returns NIL.
  2148.  
  2149.  
  2150. 3.2.  Screen Attributes
  2151.  
  2152.  
  2153. On some high resolution displays, it is possible to deal with color resources
  2154. in more than one way.  For example, you may be able to deal with a display as
  2155. either a 12-bit display with arbitrary "pixel to color" mapping (pseudo-color)
  2156. or as a 24-bit display with 8-bits of each 24-bit pixels dedicated for each
  2157. (true) color: red, green, and blue.  Different implementations of these visual
  2158. aspects of a display are called Visuals.
  2159.  
  2160.  
  2161. Many professional and/or personal computing work stations make use of a single
  2162. display processing unit coupled with a single screen and a dedicated memory
  2163. map.  The X philosophy is rather different in this respect.  In X, as well as
  2164. in CLX, each client can have multiple displays.  Each display can be of a
  2165. different visual type and different visual types can be supported at various
  2166. depths of the display's screen.  This allows for windows (including default
  2167. windows) with (possibly) different visual types to be defined for each screen.
  2168.  
  2169.  
  2170. The following concepts may serve to make the explanation of Visual
  2171. types clearer.  The screen can be color or gray scale.  The screen can have a
  2172. colormap that is writable or read-only.  A screen can also have a colormap
  2173. whose indices are decomposed into separate RGB pieces, provided one is not on a
  2174. gray scale screen.  This leads to the following diagram:
  2175.  
  2176.  
  2177.                        +-----------------+-----------------+
  2178.                        |      Color      |    Grayscale    |
  2179.                        +--------+--------+-----------------+
  2180.                        |  R/O   |  R/W   |  R/O   |  R/W   |
  2181.         +--------------+--------+--------+--------+--------+
  2182.         | Undecomposed | Static | Pseudo | Static |  Gray  |
  2183.         |   Colormap   | Color  | Color  |  Gray  | Scale  |
  2184.         +--------------+--------+--------+--------+--------+
  2185.         |  Decomposed  | True   | Direct |
  2186.         |   Colormap   | Color  | Color  |
  2187.         +--------------+--------+--------+
  2188.  
  2189.  
  2190. CLX uses a visual-info structure which contains information about the
  2191. potential color mapping.  The elements of this structure are the visual's: id,
  2192. class, red-mask, green-mask, blue-mask, bits-per-rgb, and colormap-entries.
  2193.  
  2194.  
  2195. (DEFSTRUCT visual-info
  2196.   (ID <unspec> :type card29)
  2197.   (CLASS <unspec> :type (MEMBER :static-gray :static-color :true-color
  2198.                                 :gray-scale :pseudo-color :direct-color))
  2199.   (RED-MASK <unspec> :type pixel)
  2200.   (GREEN-MASK <unspec> :type pixel)
  2201.   (BLUE-MASK <unspec> :type pixel)
  2202.   (BITS-PER-RGB <unspec> :type card8)
  2203.   (COLORMAP-ENTRIES <unspec> :type card16))
  2204.  
  2205.  
  2206. id      A unique identification number.
  2207.         
  2208. Class   The class element specifies the possible visual classes of the screen.
  2209.         It can be one of the keywords --- :direct-color, :gray-scale,
  2210.         :pseudo-color, :static-color, :static-gray, or :true-color.
  2211.  
  2212. red-mask
  2213. green-mask
  2214. blue-mask
  2215.         The red-mask, green-mask, and blue-mask elements are only meaningful
  2216.         for the :direct-color and :true-color classes.  Each mask has one
  2217.         contiguous set of bits with no intersections.
  2218.  
  2219. bits-per-rgb
  2220.         The bits-per-rgb attribute specifies the log base 2 of the approximate
  2221.         number of distinct color values (individually) of red, green, and
  2222.         blue.  Actual RGB values are unsigned 16 bit numbers.
  2223.  
  2224. colormap-entries
  2225.         The colormap-entries attribute defines the number of available colormap
  2226.         entries in a newly created colormap.  For :direct-color and
  2227.         :true-color, this will be the size of an individual pixel subfield.
  2228.  
  2229.  
  2230. Conceptually, as each pixel is read out of memory, it goes through a lookup
  2231. stage by indexing into a colormap.  Colormaps can be manipulated arbitrarily
  2232. on some hardware, in limited way on other hardware, and not at all on yet
  2233. other hardware.  The various classes of visual types affect the colormap and
  2234. the RGB values in the following ways:
  2235.  
  2236. o    For :pseudo-color, a pixel value indexes a colormap to produce
  2237.      independent RGB values, and the RGB values can be changed dynamically.
  2238.  
  2239. o    The class :gray-scale is treated the same as :pseudo-color, except the
  2240.      primary which drives the screen is undefined.  Thus, the client should
  2241.      always store the same value for red, green, and blue in the colormaps.
  2242.  
  2243. o    For :direct-color, a pixel value is decomposed into separate RGB
  2244.      subfields, and each subfield separately indexes the colormap for the
  2245.      corresponding value.  The RGB values can be changed dynamically.
  2246.  
  2247. o    The class :true-color is treated the same as :direct-color, except the
  2248.      colormap has predefined read-only RGB values.  These RGB values are server
  2249.      dependent, but provide (near-)linear ramps in each primary.
  2250.  
  2251. o    The class :static-color is treated the same as :pseudo-color, except the
  2252.      colormap has predefined read-only server dependent RGB values.
  2253.  
  2254. o    The class :static-gray is treated the same as :static-color, except the
  2255.      red, green, and blue values are equal for any single pixel value, thus
  2256.      resulting in shades of gray.  Class :static-gray with a two entry colormap
  2257.      can be thought of as monochrome.
  2258.  
  2259.  
  2260. 3.2.1.  Backing-Stores and Save-Unders-P
  2261.  
  2262.  
  2263. (DEFUN screen-backing-stores (screen)
  2264.   (DECLARE (TYPE screen screen)
  2265.            (VALUES backing-stores-type)
  2266.            (TYPE (MEMBER :always :never :when-mapped) backing-stores-type)))
  2267.  
  2268. screen  The screen structure which is to be accessed.
  2269.  
  2270. Returns a value indicating when the screen supports backing stores, although
  2271. it may be storage limited in the number of windows it can support at once.
  2272. The value returned can be one of :always, :never, or :when-mapped.  If
  2273. screen-save-unders is non-null, then the server can support the save-under
  2274. mode in create-window and in changing window attributes, although again it
  2275. may be storage limited.
  2276.  
  2277.  
  2278. (DEFUN screen-save-unders-p (screen)
  2279.   (DECLARE (TYPE screen screen)
  2280.            (VALUES save-unders?)
  2281.            (TYPE boolean save-unders?)))
  2282.  
  2283. screen  The screen structure which is to be accessed.
  2284.  
  2285. Returns non-null if the screen supports save unders, otherwise it returns
  2286. NIL.
  2287.  
  2288.  
  2289. 3.2.2.  Black-Pixel and White-Pixel
  2290.  
  2291.  
  2292. (DEFUN screen-black-pixel (screen)
  2293.   (DECLARE (TYPE screen screen)
  2294.            (VALUES black-pixel)
  2295.            (TYPE pixel black-pixel)))
  2296.  
  2297. screen  The screen structure which is to be accessed.
  2298.  
  2299. Returns the black pixel value for the specified screen.  The black pixel and
  2300. white pixel can be used in implementing a "monochrome" application.  These
  2301. pixel values are for permanently allocated entries in the default colormap.
  2302. The actual RGB values are settable on some screens and, in any case, may not
  2303. actually be "black" or "white".  The names are intended to convey the
  2304. expected relative intensity of the colors.
  2305.  
  2306.  
  2307. (DEFUN screen-white-pixel (screen)
  2308.   (DECLARE (TYPE screen screen)
  2309.            (VALUES white-pixel)
  2310.            (TYPE pixel white-pixel)))
  2311.  
  2312. screen  The screen structure which is to be accessed.
  2313.  
  2314. Returns the white pixel value for the specified screen.  The black pixel and
  2315. white pixel can be used in implementing a "monochrome" application.  These
  2316. pixel values are for permanently allocated entries in the default colormap.
  2317. The actual RGB values are settable on some screens and, in any case, may not
  2318. actually be "black" or "white".  The names are intended to convey the
  2319. expected relative intensity of the colors.
  2320.  
  2321.  
  2322. 3.2.3.  Default-Colormap, Max-Installed-Maps, and Min-Installed-Maps
  2323.  
  2324.  
  2325. (DEFUN screen-default-colormap (screen)
  2326.   (DECLARE (TYPE screen screen)
  2327.            (VALUES default-colormap)
  2328.            (TYPE colormap default-colormap)))
  2329.  
  2330. screen  The screen structure which is to be accessed.
  2331.  
  2332. Returns the default colormap for the specified screen.  This is the one
  2333. initially associated with the root window.  Clients with minimal color
  2334. requirements creating windows of the same depth as the root may want to
  2335. allocate from this map by default.  Most routine allocations of color should
  2336. be made out of this colormap.
  2337.  
  2338.  
  2339. (DEFUN screen-max-installed-maps (screen)
  2340.   (DECLARE (TYPE screen screen)
  2341.            (VALUES max-installed-colormaps)
  2342.            (TYPE card16 max-installed-colormaps)))
  2343.  
  2344. screen  The screen structure which is to be accessed.
  2345.  
  2346. Returns the maximum number of colormaps supported by the specified screen.
  2347. This specifies the maximum number of colormaps that might possibly be
  2348. installed simultaneously (with install-colormap), depending on their
  2349. allocations.  Multiple static-visual colormaps with identical contents but
  2350. differing in resource id should be considered as a single map for the
  2351. purposes of this number.  For the typical case of a single hardware
  2352. colormap, this values will be one.
  2353.  
  2354.  
  2355. (DEFUN screen-min-installed-maps (screen)
  2356.   (DECLARE (TYPE screen screen)
  2357.            (VALUES min-installed-colormaps)
  2358.            (TYPE card16 min-installed-colormaps)))
  2359.  
  2360. screen  The screen structure which is to be accessed.
  2361.  
  2362. Returns the minimum number of colormaps supported by the specified screen.
  2363. This specifies the number of maps that can be guaranteed to be installed
  2364. simultaneously (with install-colormap), regardless of the number of entries
  2365. allocated in each map.  Multiple static-visual colormaps with identical
  2366. contents but differing in resource id should be considered as a single map
  2367. for the purposes of this number.  For the typical case of a single hardware
  2368. colormap, this values will be one.
  2369.  
  2370.  
  2371. 3.2.4.  Depths
  2372.  
  2373.  
  2374. (DEFUN screen-depths (screen)
  2375.   (DECLARE (TYPE screen screen)
  2376.            (VALUES depths)
  2377.            (TYPE (alist (image-depth depth) ((LIST visual-info) visuals))
  2378.                  depths)))
  2379.  
  2380. screen  The screen structure which is to be accessed.
  2381.  
  2382. The function returns an association list that specifies what pixmap and
  2383. window depths are supported on the specified screen.  Pixmaps are supported
  2384. for each depth listed, and windows of that depth are supported if at least
  2385. one visual type is listed for the depth.  A pixmap depth of one is always
  2386. supported and listed, but windows of depth one might not be supported.  A
  2387. depth of zero is never listed, but zero-depth input only windows are always
  2388. supported.
  2389.  
  2390.  
  2391. 3.2.5.  Event-Mask-At-Open
  2392.  
  2393.  
  2394. (DEFUN screen-event-mask-at-open (screen)
  2395.   (DECLARE (TYPE screen screen)
  2396.            (VALUES event-mask-at-open)
  2397.            (TYPE mask32 event-mask-at-open)))
  2398.  
  2399. screen  The screen structure which is to be accessed.
  2400.  
  2401. Returns the initial root event mask for the specified screen.
  2402.  
  2403.  
  2404. 3.2.6.  Height, Height-In-Millimeters, Width, and Width-In-Millimeters
  2405.  
  2406.  
  2407. (DEFUN screen-height (screen)
  2408.   (DECLARE (TYPE screen screen)
  2409.            (VALUES height)
  2410.            (TYPE card16 height)))
  2411.  
  2412. screen  The screen structure which is to be accessed.
  2413.  
  2414. Returns the height of the specified screen in pixel units.
  2415.  
  2416.  
  2417. (DEFUN screen-height-in-millimeters (screen)
  2418.   (DECLARE (TYPE screen screen)
  2419.            (VALUES height-in-millimeters)
  2420.            (TYPE card16 height-in-millimeters)))
  2421.  
  2422. screen  The screen structure which is to be accessed.
  2423.  
  2424. Returns the height of the specified screen in millimeters.  This can be used
  2425. with the width in millimeters to determine the physical size and the aspect
  2426. ratio of the screen.
  2427.  
  2428.  
  2429. (DEFUN screen-width (screen)
  2430.   (DECLARE (TYPE screen screen)
  2431.            (VALUES width)
  2432.            (TYPE card16 width)))
  2433.  
  2434. screen  The screen structure which is to be accessed.
  2435.  
  2436. Returns the width of the specified screen in pixel units.
  2437.  
  2438.  
  2439. (DEFUN screen-width-in-millimeters (screen)
  2440.   (DECLARE (TYPE screen screen)
  2441.            (VALUES width-in-millimeters)
  2442.            (TYPE card16 width-in-millimeters)))
  2443.  
  2444. screen  The screen structure which is to be accessed.
  2445.  
  2446. Returns the width of the specified screen in millimeters.  This can be used
  2447. with the height in millimeters to determine the physical size and the aspect
  2448. ratio of the screen.
  2449.  
  2450.  
  2451. 3.2.7.  Plist
  2452.  
  2453.  
  2454. (DEFUN screen-plist (screen)
  2455.   (DECLARE (TYPE screen screen)
  2456.            (VALUES plist)
  2457.            (TYPE LIST plist)))
  2458.  
  2459. screen  The screen structure which is to be accessed.
  2460.  
  2461. This returns the property list for the specified screen.  This is a hook for
  2462. extensions to hang data on.
  2463.  
  2464.  
  2465. 3.2.8.  Root, Root-Depth, and Root-Visual
  2466.  
  2467.  
  2468. (DEFUN screen-root (screen)
  2469.   (DECLARE (TYPE screen screen)
  2470.            (VALUES root-window)
  2471.            (TYPE (OR NULL window) root-window)))
  2472.  
  2473. screen  The screen structure which is to be accessed.
  2474.  
  2475. Returns the root window for the specified screen.  This function is useful
  2476. with functions that take a parent window as an argument.  The class of the
  2477. root window is always input output.
  2478.  
  2479.  
  2480. (DEFUN screen-root-depth (screen)
  2481.   (DECLARE (TYPE screen screen)
  2482.            (VALUES root-window-depth)
  2483.            (TYPE image-depth root-window-depth)))
  2484.  
  2485. screen  The screen structure which is to be accessed.
  2486.  
  2487. Returns the depth (number of planes) of the root window for the specified
  2488. screen.  Other depths may also be supported on this screen.
  2489.  
  2490.  
  2491. (DEFUN screen-root-visual (screen)
  2492.   (DECLARE (TYPE screen screen)
  2493.            (VALUES root-window-visual)
  2494.            (TYPE card29 root-window-visual)))
  2495.  
  2496. screen  The screen structure which is to be accessed.
  2497.  
  2498. Returns the default visual type for the root window for the specified
  2499. screen.
  2500.  
  2501.  
  2502.  
  2503.                                   Chapter 4
  2504.  
  2505.                                    Windows
  2506.  
  2507.  
  2508. In the X window system, a window is a rectangular area on the screen that
  2509. lets you view graphical output.  Client applications can display overlapping
  2510. and nested windows on one or more screens that are driven by X servers on
  2511. one or more machines.  Clients who want to create windows must first connect
  2512. their program to the X server by calling the CLX function open-display.
  2513. This chapter begins with a discussion of visual types and window attributes.
  2514. The chapter continues with a discussion of the CLX functions you can use to:
  2515.  
  2516. o    Create windows
  2517.  
  2518. o    Obtain information about a window
  2519.  
  2520. o    Configure windows
  2521.  
  2522. o    Change window attributes
  2523.  
  2524. o    Change the stacking order
  2525.  
  2526. o    Examine the window hierarchy
  2527.  
  2528. o    Translating window coordinates
  2529.  
  2530. o    Map windows
  2531.  
  2532. o    Unmap windows
  2533.  
  2534. o    Destroy windows
  2535.  
  2536. Note that it is vital that your application conform to the established
  2537. conventions for communicating with window managers for it to work well with
  2538. the various window managers in use.  Toolkits generally adhere to these
  2539. conventions for you, relieving you of the burden.  Toolkits also often
  2540. supersede many routines in this chapter with versions of their own.  You
  2541. should see the documentation for the toolkit you are using for more
  2542. information.
  2543.  
  2544.  
  2545. 4.1.  Creating Windows
  2546.  
  2547. CLX provides basic ways of creating windows.  If you create your own top
  2548. level windows (direct children of the root window) the rules enumerated
  2549. below must be observed for applications to interact reasonably across
  2550. differing styles of window management.
  2551.  
  2552. You should never fight with a window manager for size or placement of your
  2553. top level window(s).  Toolkits often supply routines specifically for
  2554. creating and placing top level windows.  If you do not use a toolkit, you
  2555. should provide some standard information or "hints" to the window manager by
  2556. using the utility functions described in Chapter ??.
  2557.  
  2558. The policy guidelines for window creation are:
  2559.  
  2560. o    An application, by listening to the first exposure event, must be able
  2561.      to deal with whatever size window it gets, even if this means that the
  2562.      application just prints a message, like "Please make me bigger" in its
  2563.      window.
  2564.  
  2565. o    An application should only attempt to resize or move its top level
  2566.      window in direct response to a user request.  An application is free to
  2567.      resize or move the children of its top level window as necessary.
  2568.      (Toolkits often have facilities for automatic re-layout.) If a request
  2569.      to change the size of its top level window fails, the application must
  2570.      not fight with the window manager.
  2571.  
  2572. o    If an application does not use a toolkit that automatically sets
  2573.      standard window properties, that application should set these
  2574.      properties for the top level window before mapping it.  See Chapter ??
  2575.      for further information.
  2576.  
  2577. The low-level function provided by CLX to create an unmapped subwindow for a
  2578. specified parent window is create-window.  Create-window is a general
  2579. function that allows you to set specific window attributes when you create
  2580. it.
  2581.  
  2582. The X server acts as if input-only windows do not exist for the purposes of
  2583. graphics requests, exposure processing, and :visibility-notify events.  An
  2584. input-only window cannot be used as a drawable (that is, as a source or
  2585. destination for graphics requests).  In other respects input-only and
  2586. input-output windows act identically (properties, grabs, input control, and
  2587. so on).  Extension packages may define other classes of windows.
  2588.  
  2589.  
  2590. (DEFUN create-window (&key parent x y width height (depth 0)
  2591.                            (border-width 0) (class :copy) (visual :copy)
  2592.                            background border gravity bit-gravity
  2593.                            backing-store backing-planes backing-pixel
  2594.                            save-under event-mask do-not-propagate-mask
  2595.                            override-redirect colormap cursor)
  2596.   (DECLARE (TYPE window :parent)
  2597.            (TYPE int16 :x :y)
  2598.            (TYPE card16 :width :height :depth :border-width)
  2599.            (TYPE (MEMBER :copy :input-output :input-only) :class)
  2600.            (TYPE (OR (MEMBER :copy) visual) :visual)
  2601.            (TYPE (OR NULL (MEMBER :none :parent-relative) pixel pixmap)
  2602.                  :background)
  2603.            (TYPE (OR NULL (MEMBER :copy) pixel pixmap) :border)
  2604.            (TYPE (OR NULL win-gravity) :gravity)
  2605.            (TYPE (OR NULL bit-gravity) :bit-gravity)
  2606.            (TYPE (OR NULL (MEMBER :not-useful :when-mapped :always)
  2607.                      backing-store) :backing-store)
  2608.            (TYPE (OR NULL pixel) :backing-planes :backing-pixel)
  2609.            (TYPE (OR NULL event-mask) :event-mask)
  2610.            (TYPE (OR NULL device-event-mask) :do-not-propagate-mask)
  2611.            (TYPE (OR NULL (MEMBER :on :off)) :save-under :override-redirect)
  2612.            (TYPE (OR NULL (MEMBER :copy) colormap) :colormap)
  2613.            (TYPE (OR NULL (MEMBER :none) cursor) :cursor)
  2614.            (VALUES window-structure)
  2615.            (TYPE window window-structure)))
  2616.  
  2617. :parent A required keyword argument that specifies the parent for the window
  2618.         which is to be created.
  2619.  
  2620. :x
  2621. :y      Required keyword arguments which specify the x and y coordinates for
  2622.         the top, left, outside corner of the borders for the window which is
  2623.         being created.  These coordinates are relative to the inside of the
  2624.         parent window's borders.
  2625.  
  2626. :width
  2627. :height Required keyword arguments which specify the inside dimensions, in
  2628.         pixels, of the window which is being created.  These dimensions do
  2629.         not include the window borders and must be greater than zero.
  2630.  
  2631. :depth  A depth of zero for class :input-output or :copy means the depth is
  2632.         taken from the parent.
  2633.  
  2634. :border-width
  2635.         Specifies, in pixels, the width of the created window's border.  The
  2636.         border-width for an input-only window must be zero.
  2637.  
  2638. :class  Specifies the created window's class.  A class of :copy means the
  2639.         class is taken from the parent.
  2640.  
  2641. :visual Specifies the visual type.  A visual of :copy means the visual type
  2642.         is taken from the parent.
  2643.  
  2644. :background
  2645. :border
  2646. :gravity
  2647. :bit-gravity
  2648. :backing-store
  2649. :backing-planes
  2650. :backing-pixel
  2651. :save-under
  2652. :event-mask
  2653. :do-not-propagate-mask
  2654. :override-redirect
  2655. :colormap
  2656. :cursor Specifies the attributes of the window which are to be set at
  2657.         creation time.  Only the non-null attributes are passed on in the
  2658.         request and no assumption is made about what the actual protocol
  2659.         defaults are.  See Section 4.4 for further information on window
  2660.         attributes.
  2661.  
  2662. The create-window function creates an unmapped subwindow for a specified
  2663. parent window, returns the window structure for the created window, and
  2664. causes the X server to generate a :create-notify event.  The created window
  2665. is placed on top in the stacking order with respect to siblings.
  2666.  
  2667. For the input-output class of windows, the visual type and depth must be a
  2668. combination supported for the screen.  The depth need not be the same as the
  2669. parent, but the parent must not be a window of class input-only.
  2670.  
  2671. For an input-only window the depth must be zero, and the visual must be one
  2672. supported by the screen.  The parent window, however, may have any depth and
  2673. class.  The only window attributes defined for input-only windows are
  2674. gravity, event-mask, do-not-propagate-mask, override-redirect, and cursor.
  2675.  
  2676. A window manager may override your choice as to size, border-width, and
  2677. position for a window when it is first mapped.  Your program must be
  2678. prepared to use the actual size and position of the top window, which is
  2679. reported back.  It is not acceptable for a client application to resize
  2680. itself unless in direct response to a human command to do so.  Instead, your
  2681. program should either use the space given to it, or, if the space is too
  2682. small for any useful work, your program might ask the user to resize the
  2683. window.  The border of your top level windows are considered fair game for
  2684. window managers.
  2685.  
  2686.  
  2687. 4.2.  Obtaining Information About a Window
  2688.  
  2689. CLX provides a number of useful functions that return data from a window
  2690. structure.  All other elements (that is, those for which no functions are
  2691. defined) are internal to CLX and must not be used.  The following lists the
  2692. Common LISP language functions and what data they return for the specified
  2693. window structure.
  2694.  
  2695.  
  2696. (DEFUN window-class (window)
  2697.   (DECLARE (TYPE window window)
  2698.            (VALUES class)
  2699.            (TYPE (MEMBER :input-only :input-output) class)))
  2700.  
  2701. window  The window structure which is to be accessed.
  2702.  
  2703. This function returns the class of the specified window object.  The only
  2704. two classes supported in the core protocol are :input-only and :input-output
  2705. but extension packages may define other classes of windows.  The X server
  2706. acts as if input-only windows do not exist for the purposes of graphics
  2707. requests, exposure processing, and visibility-notify events.  An input-only
  2708. window cannot be used as a drawable (that is, as a source or destination for
  2709. graphics requests).  In other respects input-only and input-output windows
  2710. act identically (properties, grabs, input control, and so on).
  2711.  
  2712.  
  2713. (DEFUN window-equal (window-1 window-2)
  2714.   (DECLARE (TYPE window window-1 window-2)
  2715.            (VALUES equal?)
  2716.            (TYPE boolean equal?)))
  2717.  
  2718. window-1
  2719. window-2
  2720.         The window structures which are to be compared for equality.
  2721.  
  2722. This function returns non-null if the two arguments are the same windows and
  2723. NIL if they are not.
  2724.  
  2725.  
  2726. (DEFUN window-id (window)
  2727.   (DECLARE (TYPE window window)
  2728.            (VALUES id)
  2729.            (TYPE resource-id id)))
  2730.  
  2731. window  The window structure which is to be accessed.
  2732.  
  2733. This function returns the unique id that has been assigned to the specified
  2734. window by the server.
  2735.  
  2736.  
  2737. (DEFUN window-p (window)
  2738.   (DECLARE (TYPE T window)
  2739.            (VALUES window?)
  2740.            (TYPE boolean window?)))
  2741.  
  2742. window  The window structure which is to be accessed.
  2743.  
  2744. This function returns non-null if the window argument is a window structure,
  2745. otherwise it returns NIL.
  2746.  
  2747.  
  2748. (DEFUN window-plist (window)
  2749.   (DECLARE (TYPE window window)
  2750.            (VALUES plist)
  2751.            (TYPE list plist))))
  2752.  
  2753. window  The window structure which is to be accessed.
  2754.  
  2755. This returns the property list for the specified window.  This is a hook for
  2756. extensions to hang data on.
  2757.  
  2758.  
  2759. (DEFUN window-visual (window)
  2760.   (DECLARE (TYPE window window)
  2761.            (VALUES visual-type)
  2762.            (TYPE card29 visual-type)))
  2763.  
  2764. window  The window structure which is to be accessed.
  2765.  
  2766. This function returns the visual type associated with the specified window.
  2767.  
  2768.  
  2769. 4.3.  Window Configuration
  2770.  
  2771. All drawables have a border-width, an x and y position, a width, a height,
  2772. and a depth (collectively referred to as the geometry).  In addition, windows
  2773. have a stacking priority.  The border-width element specifies the width of
  2774. the border in pixels.  The x and y elements specify the x and y coordinates
  2775. relative to the parent's origin and indicate the position of the upper,
  2776. left, outer corner for a window.  The width and height elements specify the
  2777. inside size of the drawable, in pixels, not including the border.  Depth is
  2778. the number of bits per pixel for the drawable.  The stacking priority
  2779. element specifies the priority of a window, relative to its siblings, for
  2780. stacking operations.
  2781.  
  2782. For the input-only class of windows the border-width is always zero.  For
  2783. pixmaps x, y, and border-width will always be zero.
  2784.  
  2785. CLX provides functions with which you can obtain information about and
  2786. change a drawables configuration.  The configuration includes the
  2787. information that describes the geometry of the a drawable.  Modifying the
  2788. configuration is how you move a window, resize a window, modify the depth of
  2789. a window, change a window's border-width, or change a window's stacking
  2790. priority.  Attempts to change the configuration of a root window have no
  2791. effect and the elements of the configuration of pixmaps are not settable.
  2792.  
  2793. When the geometry of a window is changed, the window is restacked among
  2794. siblings, the restack check is performed with respect to the window's final
  2795. size and position (NOT its initial position), and a configure-notify event
  2796. is generated if the state of the window actually changes.  The X server
  2797. generates gravity-notify events after generating configure-notify events.
  2798. Exposure processing is performed on formerly obscured windows, including the
  2799. window itself and its inferiors, if regions of them were obscured but now
  2800. are not.
  2801.  
  2802. The complete set of elements in the window configuration are discussed in
  2803. the following sections.
  2804.  
  2805.  
  2806. 4.3.1.  Border-Width
  2807.  
  2808. The border-width specifies the width, in pixels, of the area on each of the
  2809. four sides of a window, that is occupied by the window border.  The value is
  2810. always zero or greater.  For pixmaps and input-only windows the border-width
  2811. is always zero.
  2812.  
  2813. Output to a window is always clipped to the inside of the window.
  2814. Therefore, graphic operations never affect the window border.  The border of
  2815. your top level windows are considered fair game for window managers.  Also,
  2816. the window manager may override the value for border-width and your program
  2817. must be prepared to deal with this.
  2818.  
  2819.  
  2820. (DEFUN drawable-border-width (drawable)
  2821.   (DECLARE (TYPE drawable drawable)
  2822.            (VALUES border-width)
  2823.            (TYPE card16 border-width)))
  2824.  
  2825. drawable
  2826.         The drawable whose border-width is to be accessed.
  2827.  
  2828. Settable for windows only.
  2829.  
  2830. This function returns the border-width element of the specified drawable in
  2831. pixels.  It always returns zero if the drawable is a pixmap or an input-only
  2832. window.
  2833.  
  2834. Changing just the border-width leaves the outer-left corner of a window in a
  2835. fixed position, but moves the absolute position of the window's origin.  It
  2836. is an error to make the border-width of an input-only window non-zero.
  2837.  
  2838.  
  2839. 4.3.2.  X and Y Position
  2840.  
  2841. The x and y position defines the location of the drawable.  For a window,
  2842. these coordinates specify the upper, left, outer corner relative to its
  2843. parent's origin.  For pixmaps, these coordinates are always zero.
  2844.  
  2845. A window manager may override your choice as to position for a window and
  2846. your program must be prepared to deal with this.
  2847.  
  2848. (DEFUN drawable-x (drawable)
  2849.   (DECLARE (TYPE drawable drawable)
  2850.            (VALUES outside-left)
  2851.            (TYPE int16 outside-left)))
  2852.  
  2853. drawable
  2854.         The drawable whose x position is to be accessed.
  2855.  
  2856. Settable for windows only.
  2857.  
  2858.  
  2859. (DEFUN drawable-y (drawable)
  2860.   (DECLARE (TYPE drawable drawable)
  2861.            (VALUES outside-top)
  2862.            (TYPE int16 outside-top)))
  2863.  
  2864. drawable
  2865.         The drawable whose y position is to be accessed.
  2866.  
  2867. Settable for windows only.
  2868.  
  2869. These functions return the x or y coordinate of the specified drawable.
  2870. They always returns zero if the drawable is a pixmap.  These coordinates
  2871. define the location of the top left pixel of the window's border or the
  2872. window itself, if it has no border.
  2873.  
  2874. Changing just the x and y coordinates is how you move a window without
  2875. changing its size.  Setting these values moves the window to the specified x
  2876. and y coordinates, but it does not change the window's size, does not raise
  2877. the window, and does not change the mapping state of the window.
  2878.  
  2879. Moving a mapped window may or may not lose its contents depending on:
  2880.  
  2881. o    If its background attribute has the value :parent-relative.
  2882.  
  2883. o    If the window is obscured by non-children, and no backing store exists.
  2884.  
  2885. If the contents of the window are lost, exposure events will be generated
  2886. for the window and any mapped subwindows.  Moving a mapped window will
  2887. generate exposure events on any formerly obscured windows.
  2888.  
  2889. When changing the position of a window, if the override-redirect attribute
  2890. of the window is :off and some other client has selected
  2891. substructure-redirect on the parent, a configure-request event is generated,
  2892. and no further processing is performed.  Otherwise, the window is moved.
  2893.  
  2894.  
  2895. 4.3.3.  Width and Height
  2896.  
  2897. The width and height elements define the inside size, in pixels, of the
  2898. drawable, not including the border.  These values are always greater than
  2899. zero.
  2900.  
  2901. A window manager may override your choice as to size for a top level window
  2902. and your program must be prepared to deal with this.  Also, it is not
  2903. acceptable for a client application to resize itself unless in direct
  2904. response to a human command to do so.  Instead, your program should either
  2905. use the space given to it, or, if the space is too small for any useful
  2906. work, your program might ask the user to resize the window.
  2907.  
  2908.  
  2909. (DEFUN drawable-height (drawable)
  2910.   (DECLARE (TYPE drawable drawable)
  2911.            (VALUES inside-height)
  2912.            (TYPE card16 inside-height)))
  2913.  
  2914. drawable
  2915.         The drawable whose height element is to be accessed.
  2916.  
  2917. Settable for windows only.
  2918.  
  2919.  
  2920. (DEFUN drawable-width (drawable)
  2921.   (DECLARE (TYPE drawable drawable)
  2922.            (VALUES inside-width)
  2923.            (TYPE card16 inside-width)))
  2924.  
  2925. drawable
  2926.         The drawable whose width element is to be accessed.
  2927.  
  2928. Settable for windows only.
  2929.  
  2930. These functions return the height or width element of the specified
  2931. drawable.  These coordinates define the inside size of the drawable, in
  2932. pixels, or of the entire window, if it has no border.
  2933.  
  2934. Changing just the width and height is how you resize a window without
  2935. changing its position.  Setting these values changes the inside dimensions
  2936. of the window to the specified width and height, but it does not change the
  2937. position of the window's upper, left corner or its origin, does not raise
  2938. the window, and does not change the mapping state of the window.
  2939.  
  2940. Changing the size of a mapped window may lose its contents and generate an
  2941. expose event.  If a mapped window is made smaller, exposure events will be
  2942. generated on windows that it formerly obscured.
  2943.  
  2944. When changing the size of a window, if the override-redirect attribute of
  2945. the window is :off and some other client has selected substructure-redirect
  2946. on the parent, a configure-request event is generated, and no further
  2947. processing is performed.  Otherwise, if some other client has selected
  2948. resize-redirect on the window a resize-request event is generated, and the
  2949. current inside width and height are maintained.  Note that the
  2950. override-redirect attribute of the window has no effect on resize-redirect
  2951. and that substructure-redirect on the parent has precedence over
  2952. resize-redirect on the window.
  2953.  
  2954. When the inside size of the window is changed the children of the window may
  2955. move according to their window gravity.  Depending on the window's bit
  2956. gravity, the contents of the window also may be moved.  See Section 4.4.3
  2957. for further information.
  2958.  
  2959.  
  2960. 4.3.4.  Depth
  2961.  
  2962. The depth of a drawable is the number of bits per pixel it has.  This depth
  2963. must be one of the depths that is supported by the screen for this drawable.
  2964. For an input-only window the depth is always zero.
  2965.  
  2966.  
  2967. (DEFUN drawable-depth (drawable)
  2968.   (DECLARE (TYPE drawable drawable)
  2969.            (VALUES depth)
  2970.            (TYPE card8 depth)))
  2971.  
  2972. drawable
  2973.         The drawable whose width element is to be accessed.
  2974.  
  2975. This function returns the depth of the specified drawable (bits per pixel).
  2976.  
  2977.  
  2978. 4.3.5.  Stacking Priority
  2979.  
  2980. The stacking priority element specifies the priority of a window, relative
  2981. to its siblings, for stacking operations.  Possible values are :above,
  2982. :below, :bottom-if, :opposite, or :top-if.
  2983.  
  2984. If a sibling window is specified, the window is restacked based on the mode
  2985. as follows:
  2986.  
  2987. :above          The window is placed just above the sibling.
  2988.  
  2989. :below          The window is placed just below the sibling.
  2990.  
  2991. :bottom-if      If the window occludes the sibling, the window is placed at
  2992.                 the bottom of the stack.
  2993.  
  2994. :opposite       If the sibling occludes the window, the window is placed at
  2995.                 the top of the stack.  Otherwise, if the window occludes the
  2996.                 sibling, the window is placed at the bottom of the stack.
  2997.  
  2998. :top-if         If the sibling occludes the window, the window is placed at
  2999.                 the top of the stack.
  3000.  
  3001. If no sibling is specified (value of NIL), the window is restacked based on
  3002. the mode as follows:
  3003.  
  3004. :above          The window is placed at the top of the stack.
  3005.  
  3006. :below          The window is placed at the bottom of the stack.
  3007.  
  3008. :bottom-if      If the window occludes any sibling, the window is placed at
  3009.                 the bottom of the stack.
  3010.  
  3011. :opposite       If any sibling occludes the window, the window is placed at
  3012.                 the top of the stack.  Otherwise, if the window occludes any
  3013.                 sibling, the window is placed at the bottom of the stack.
  3014.  
  3015. :top-if         If any sibling occludes the window, the window is placed at
  3016.                 the top of the stack.
  3017.  
  3018. The X protocol does not allow retrieval of the stacking priority value for a
  3019. window.  It is only settable.  In other words, it is a write only value.
  3020.  
  3021.  
  3022. (DEFSETF window-priority (window &optional sibling) (mode)
  3023.   (DECLARE (TYPE window window)
  3024.            (TYPE (OR NULL window) sibling)
  3025.            (TYPE (MEMBER :above :below :bottom-if :opposite :top-if) mode)
  3026.            (VALUES mode)
  3027.               (TYPE (MEMBER :above :below :bottom-if :opposite :top-if) mode)))
  3028.  
  3029. window  Specifies the window whose stacking priority is to be set.
  3030.  
  3031. sibling An optional argument specifying a sibling window which this window is
  3032.         to be restacked relative to.
  3033.  
  3034. mode    Specifies the new value for the stacking priority.  It may be
  3035.         :above, :below, :bottom-if, :opposite, or :top-if as described
  3036.         above.
  3037.  
  3038. This SETF operation changes the stacking priority element of the window to
  3039. the value specified.  It is an error if the sibling argument is not actually
  3040. a sibling of the window.
  3041.  
  3042.  
  3043. 4.4.  Window Attributes
  3044.  
  3045. All windows have a border, an optional background, an input mask, an event
  3046. suppression mask, and a property list.  The window border and background can
  3047. be a solid color or a pattern, called a tile.  All windows except the root
  3048. have a parent and are clipped by their parent.  If a window is stacked on
  3049. top of another window, it obscures that other window for the purpose of
  3050. input.  If a window has a background (almost all do), it obscures the other
  3051. window for purposes of output.  Attempts to output to the obscured area will
  3052. do nothing, and no input events (for example, pointer motion) will be
  3053. generated for the obscured area.
  3054.  
  3055. The input-only class of windows only have the following attributes:
  3056.  
  3057. o    gravity
  3058.  
  3059. o    event-mask
  3060.  
  3061. o    do-not-propagate-mask
  3062.  
  3063. o    override-redirect
  3064.  
  3065. o    cursor
  3066.  
  3067. They are used for controlling input events in situations where full-fledged
  3068. windows are unnecessary.  An error is generated if you specify any other
  3069. attributes for an input-only window.
  3070.  
  3071. Windows have borders of a programmable width and pattern as well as a
  3072. background pattern or tile.  Pixels can be used for solid colors.  The
  3073. background and border pixmaps may be destroyed immediately after creating
  3074. the window if no further explicit references to them are to be made.
  3075.  
  3076. A window's background pattern can be either a solid color or a pattern.  The
  3077. pattern can either be relative to the parent or absolute.  If relative to
  3078. the parent, the pattern will be shifted appropriately to match the parent
  3079. window.  If absolute, the pattern will be positioned in the window
  3080. independently of the parent window.
  3081.  
  3082.  
  3083. (DEFMACRO with-state ((drawable) &body body))
  3084.  
  3085. drawable
  3086.         The drawable whose state is to be maintained.
  3087.  
  3088. The with-state macro allows a consistent view to be obtained and allows a
  3089. coherent update of the window attributes and window geometry.  The body is not
  3090. surrounded by a with-display.  Within the indefinite scope of the body, on a
  3091. per-process basis in a multi-process environment, the first call within an
  3092. Accessor Group on the specified drawable (the object, not just the variable)
  3093. causes the complete results of the protocol request to be retained, and
  3094. returned in any subsequent accessor calls.  Calls within a SETF Group are
  3095. delayed, and executed in a single request on exit from the body.  In addition,
  3096. if a call on a function within an Accessor Group follows a call on a function
  3097. in the corresponding SETF Group, then all delayed SETFs for that group are
  3098. executed, any retained accessor information for that group is discarded, the
  3099. corresponding protocol request is (re)issued, and the results are (again)
  3100. retained, and returned in any subsequent accessor calls.
  3101.  
  3102.  
  3103.  
  3104. The complete set of window attributes are discussed in the following sections.
  3105.  
  3106. 4.4.1.  Background
  3107.  
  3108. The background attribute specifies a pixel value used to paint a window's
  3109. background in a single color or a pixmap to be used for a window's
  3110. background.  Possible values are any pixel value, a pixmap, :none, or
  3111. :parent-relative.  The default value is :none.
  3112.  
  3113. If the background attribute is a pixel, a pixmap of undefined size filled
  3114. with the pixel is used for the background.  If the background is a pixmap,
  3115. it overrides the default background.  A background pixmap can be of any size
  3116. (although some sizes may be faster than others) but the pixmap and the
  3117. window must have the same root and the same depth.  If the background
  3118. attribute is :none then the window has no defined background.  If you set
  3119. the background to :parent-relative:
  3120.  
  3121. o    The parent window's background is used, but the child window must have
  3122.      the same depth as its parent.  If the parent window has a background of
  3123.      :none, the window will also have a background of :none.
  3124.  
  3125. o    A copy of the parent window's background is not made.  The parent's
  3126.      background is examined each time the child window background is
  3127.      required.
  3128.  
  3129. o    The background tile origin always aligns with the parent window's
  3130.      background tile origin.  Otherwise, the background tile origin is
  3131.      always the child window origin.
  3132.  
  3133. Setting a new value for the background attribute overrides any previous
  3134. background.  If the value is a pixmap it can be freed immediately if no
  3135. further explicit reference is made to it (the X server will keep a copy to
  3136. use when needed).  If you later draw into the pixmap used for the
  3137. background, X does not predict what happens because the X implementation is
  3138. free to either make a copy of the pixmap or just use the same pixmap.
  3139.  
  3140. When no valid contents are available for regions of a window, and either the
  3141. regions are visible, or the server is maintaining backing store, the server
  3142. automatically tiles the regions with the window's background, unless the
  3143. window has a background of :none.  If the background is :none, the previous
  3144. screen contents are simply left in place, if the contents come from an
  3145. inferior window of the same depth.  Otherwise, the initial contents of the
  3146. exposed regions are undefined.  Exposure events are then generated for the
  3147. regions, even if the background is :none.  See Chapter ??  for a discussion
  3148. of exposure event processing.
  3149.  
  3150. The X protocol does not allow retrieval of the background attribute value
  3151. for a window.  It is only settable.  In other words, it is a write only
  3152. value.
  3153.  
  3154.  
  3155. (DEFSETF window-background (window) (background)
  3156.   (DECLARE (TYPE window window)
  3157.            (TYPE (OR (MEMBER :none :parent-relative) pixel pixmap)
  3158.                  background)
  3159.            (VALUES background)
  3160.            (TYPE (OR (MEMBER :none :parent-relative) pixel pixmap)
  3161.                  background)))
  3162.  
  3163. window  Specifies the window whose background attribute is to be set.
  3164.  
  3165. background
  3166.         Specifies the new value for background attribute.  It may be a pixel
  3167.         value, a pixmap, :none, or :parent-relative as described above.
  3168.  
  3169. This SETF operation changes the background attribute of the window to the
  3170. value specified.  This operation is not allowed on an input-only window.
  3171. Changing the background does not cause the window contents to be changed.
  3172. You may wish to clear and repaint the screen after executing this operation
  3173. because they will not repaint the background you just set.
  3174.  
  3175.  
  3176. 4.4.2.  Border
  3177.  
  3178. The border attribute specifies a pixel value used to paint a window's border
  3179. in a single color or a pixmap to be used for a window's border.  Possible
  3180. values are any pixel value, a pixmap, or :copy.  The default value is :copy.
  3181.  
  3182. If the border attribute is a pixel, a pixmap of undefined size filled with
  3183. the pixel is used for the border.  If the border is a pixmap, it overrides
  3184. the default border.  A border pixmap can be of any size (although some sizes
  3185. may be faster than others) but the pixmap and the window must have the same
  3186. root and the same depth.  This pixmap can be of any size, although some
  3187. sizes may be faster than others.  The border tile origin is always the same
  3188. as the background tile origin.  If you set the border to :copy the pixmap
  3189. used for the border will be a copy of the parent window's border pixmap.
  3190. Subsequent changes to the parent window's border attribute do not affect the
  3191. child window.
  3192.  
  3193. Setting a new value for the border attribute overrides any previous border.
  3194. If the value is a pixmap it can be freed immediately if no further explicit
  3195. reference is made to it.  If you later draw into the pixmap used for the
  3196. border, X does not predict what happens because the X implementation is free
  3197. to either make a copy of the pixmap or use the same pixmap each time the
  3198. window border is repainted.
  3199.  
  3200. Output to a window is always clipped to the inside of the window.
  3201. Therefore, graphic operations never affect the window border.  Borders are
  3202. added to the window size specified.
  3203.  
  3204. The X protocol does not allow retrieval of the border attribute value for a
  3205. window.  It is only settable.  In other words, it is a write only value.
  3206.  
  3207.  
  3208. (DEFSETF window-border (window) (border)
  3209.   (DECLARE (TYPE window window)
  3210.            (TYPE (OR (MEMBER :copy) pixel pixmap) border)
  3211.            (VALUES border)
  3212.            (TYPE (OR (MEMBER :copy) pixel pixmap) border)))
  3213.  
  3214. window  Specifies the window whose border attribute is to be set.
  3215.  
  3216. border  Specifies the new value for border attribute.  It may be a pixel
  3217.         value, a pixmap, or :copy as described above.
  3218.  
  3219. This SETF operation changes the border attribute of the window to the value
  3220. specified.  This operation is not allowed on an input-only window.  Changing
  3221. the border attribute also causes the window border to be repainted.
  3222.  
  3223.  
  3224. 4.4.3.  Bit Gravity and Window Gravity Attributes
  3225.  
  3226.  
  3227. (DEFTYPE bit-gravity () '(MEMBER :center :east :forget :north :north-east
  3228.                                  :north-west :south :south-east :south-west
  3229.                                  :static :west))
  3230.  
  3231. Bit gravity defines which region of the window should be retained when the
  3232. window is resized.  The default value for the bit-gravity attribute is
  3233. :forget.
  3234.  
  3235.  
  3236. (DEFTYPE win-gravity () '(MEMBER :center :east :north :north-east
  3237.                                  :north-west :south :south-east :south-west
  3238.                                  :static :unmap :west))
  3239.  
  3240. Window gravity allows you to define how the window should be repositioned if
  3241. its parent is resized.  The default value for the window gravity attribute
  3242. is :north-west.
  3243.  
  3244. If the inside width or height of a window is not changed, and if the window
  3245. is moved or its border is changed, then the contents of the window are not
  3246. lost but move with the window.  Changing the inside width or height of the
  3247. window causes its contents to be moved or lost, depending on the bit-gravity
  3248. of the window, and causes children to be reconfigured, depending on their
  3249. window gravity.  For a change of width and height, the (x, y) pairs are
  3250. defined as:
  3251.  
  3252.           -----------------------------------------
  3253.           Gravity Direction     Coordinates
  3254.           -----------------------------------------
  3255.  
  3256.           :center               (width/2, height/2)
  3257.  
  3258.           :east                 (width, height/2)
  3259.  
  3260.           :north                (width/2, 0)
  3261.  
  3262.           :north-east           (width, 0)
  3263.  
  3264.           :north-west           (0, 0)
  3265.  
  3266.           :south                (width/2, height)
  3267.  
  3268.           :south-east           (width, height)
  3269.  
  3270.           :south-west           (0, height)
  3271.  
  3272.           :west                 (0, height/2)
  3273.           -----------------------------------------
  3274.  
  3275. When a window having one of these bit-gravities is resized, the
  3276. corresponding (x, y) pair defines the change in position of each pixel in
  3277. the window.  When a window with one of these window gravities has its parent
  3278. window resized, the corresponding pair defines the change in position of the
  3279. window within the parent.  When a window is so repositioned, a
  3280. gravity-notify event is generated.  The gravity-notify events are generated
  3281. after the configure-notify event is generated.
  3282.  
  3283. A bit-gravity of :static indicates that the contents or origin should not
  3284. move relative to the origin of the root window.  If the change in size of
  3285. the window is coupled with a change in position (x, y), then for bit-gravity
  3286. the change in position of each pixel is (-x, -y), and for window gravity the
  3287. change in position of a child when its parent is so resized is (-x, -y).
  3288. Note that :static gravity still only takes effect when the width or height
  3289. of the window is changed, not when the window is moved.
  3290.  
  3291. A bit-gravity of :forget indicates that the window's contents are always
  3292. discarded after a size change, even if a backing-store or save-under has
  3293. been requested.  The window is tiled with its background and one or more
  3294. exposure events are generated.  If no background is defined, the existing
  3295. screen contents are not altered.  Some X servers may also ignore the
  3296. specified bit-gravity and always generate exposure events.
  3297.  
  3298. A window gravity of :unmap is like :north-west (the window is not moved),
  3299. but the child is also unmapped when the parent is resized, and an
  3300. :unmap-notify event is generated.  The unmap-notify events are generated
  3301. after the configure-notify event is generated.
  3302.  
  3303.  
  3304. (DEFUN window-bit-gravity (window)
  3305.   (DECLARE (TYPE window window)
  3306.            (VALUES bit-gravity?)
  3307.            (TYPE bit-gravity bit-gravity?)))
  3308.  
  3309. Settable.
  3310.  
  3311. window  Specifies the window whose bit-gravity attribute is to be accessed.
  3312.  
  3313. Returns the value of the bit-gravity attribute for the specified window.
  3314.  
  3315.  
  3316. (DEFUN window-gravity (window)
  3317.   (DECLARE (TYPE window window)
  3318.            (VALUES gravity)
  3319.            (TYPE win-gravity gravity)))
  3320.  
  3321. Settable.
  3322.  
  3323. window  Specifies the window whose window gravity attribute is to be
  3324.         accessed.
  3325.  
  3326. Returns the value of the window gravity attribute for the specified window.
  3327. Changing the window gravity does not affect the current position of the
  3328. window.
  3329.  
  3330.  
  3331. 4.4.4.  Backing-Store
  3332.  
  3333. Some implementations of the X server may choose to maintain the contents of
  3334. windows.  If the X server maintains the contents of a window, the off-screen
  3335. saved pixels are known as backing store.  The backing-store attribute
  3336. advises the X server on what to do with the contents of a window.  Possible
  3337. values for this attribute are :always, :not-useful, and :when-mapped.  The
  3338. default value is :not-useful.
  3339.  
  3340. A backing-store of :when-mapped advises the X server that maintaining
  3341. contents of obscured regions when the window is mapped would be beneficial.
  3342. In this case, the server may generate an exposure event when the window is
  3343. created.  A backing-store of :always advises the X server that maintaining
  3344. contents even when the window is unmapped would be beneficial.  Even if the
  3345. window is larger than its parent, this is a request to the X server to
  3346. maintain complete contents, not just the region within the parent window
  3347. boundaries.  While the X server maintains contents, exposure events normally
  3348. will not be generated, but the X server may stop maintaining contents at any
  3349. time.  A backing-store of :not-useful advises the X server that maintaining
  3350. contents is unnecessary, although some X implementations may still choose to
  3351. maintain contents and, therefore, not generate exposure events.
  3352.  
  3353. When the contents of obscured regions of a window are being maintained,
  3354. regions obscured by non-inferior windows are included in the destination
  3355. (AND source, when the window is the source) of graphics requests.  However,
  3356. regions obscured by inferior windows are not included.
  3357.  
  3358.  
  3359. (DEFUN window-backing-store (window)
  3360.   (DECLARE (TYPE window window)
  3361.            (VALUES backing-store-type)
  3362.            (TYPE (MEMBER :always :not-useful :when-mapped)
  3363.                  backing-store-type)))
  3364.  
  3365. Settable.
  3366.  
  3367. window  Specifies the window whose backing-store attribute is to be
  3368.         accessed.
  3369.  
  3370. Returns the value of the backing-store attribute for the specified window.
  3371. Changing the backing-store attribute of an obscured window to :when-mapped
  3372. or :always may have no immediate effect.
  3373.  
  3374.  
  3375. 4.4.5.  Save-Under
  3376.  
  3377. Some server implementations may preserve bits of windows under other
  3378. windows.  This is not the same as preserving the contents of a window.  You
  3379. may get better visual appeal if transient windows (for example, pop-up
  3380. menus) request that the system preserve the bits under them, so the
  3381. temporarily obscured applications do not have to repaint.
  3382.  
  3383. The default value for the save-under attribute is :off.  If save-under is
  3384. :on, the X server is advised that, when this window is mapped, saving the
  3385. contents of windows it obscures would be beneficial.
  3386.  
  3387.  
  3388. (DEFUN window-save-under (window)
  3389.   (DECLARE (TYPE window window)
  3390.            (VALUES save-under)
  3391.            (TYPE (MEMBER :on :off) save-under)))
  3392.  
  3393. Settable.
  3394.  
  3395. window  Specifies the window whose save-under attribute is to be accessed.
  3396.  
  3397. Returns the value of the save-under attribute for the specified window.
  3398. Changing the save-under attribute of a mapped window may have no immediate
  3399. effect.
  3400.  
  3401.  
  3402. 4.4.6.  Backing-Planes and Backing-Pixel Attributes
  3403.  
  3404. The backing-planes attribute indicates (with one bits) which bit planes of
  3405. the window hold dynamic data that must be preserved in backing store and
  3406. during save unders.  The default value for the backing-planes attribute is
  3407. all ones.  The backing-pixel specifies what values to use in planes not
  3408. covered by backing-planes.  The default value for the backing-pixel
  3409. attribute is zero.  The X server is free to save only the specified bit
  3410. planes in the backing store or the save under and is free to regenerate the
  3411. remaining planes with the specified pixel value.  Any extraneous bits (that
  3412. is, those beyond the specified depth of the window) in these values may be
  3413. simply ignored.  If you request backing store or save unders you should use
  3414. these attributes to minimize the amount of off-screen memory required to
  3415. store your window.
  3416.  
  3417.  
  3418. (DEFUN window-backing-pixel (window)
  3419.   (DECLARE (TYPE window window)
  3420.            (VALUES backing-pixel)
  3421.            (TYPE pixel backing-pixel)))
  3422.  
  3423. Settable.
  3424.  
  3425. window  Specifies the window whose backing-pixel attribute is to be
  3426.         accessed.
  3427.  
  3428. Returns the value of the backing-pixel attribute for the specified window.
  3429. Changing the backing-pixel attribute of a mapped window may have no
  3430. immediate effect.
  3431.  
  3432.  
  3433. (DEFUN window-backing-planes (window)
  3434.   (DECLARE (TYPE window window)
  3435.            (VALUES backing-planes)
  3436.            (TYPE pixel backing-planes)))
  3437.  
  3438. Settable.
  3439.  
  3440. window  Specifies the window whose backing-planes attribute is to be
  3441.         accessed.
  3442.  
  3443. Returns the value of the backing-planes attribute for the specified window.
  3444. Changing the backing-planes attribute of a mapped window may have no
  3445. immediate effect.
  3446.  
  3447.  
  3448. 4.4.7.  Event-Mask and Do-Not-Propagate-Mask Attributes
  3449.  
  3450. The event-mask defines which events the client is interested in for this
  3451. window (OR, for some event types, inferiors of the window).  The
  3452. do-not-propagate-mask defines which events should not be propagated to
  3453. ancestor windows when no client has the event type selected in this window.
  3454. These masks are the bitwise inclusive-or of one or more of the valid event
  3455. mask bits.  The default value for these attributes is the empty set.
  3456.  
  3457.  
  3458. Multiple clients can select input on the same window but their event-masks
  3459. are disjoint.  When an event is generated it will be reported to all
  3460. interested clients.  However, at most one client at a time can select
  3461. substructure redirect, at most one client at a time can select resize
  3462. redirect, and at most one client at a time can select button press.  There
  3463. is only one do-not-propagate-mask for a window, not one per client.
  3464.  
  3465.  
  3466. (DEFTYPE event-mask-class ()
  3467.   '(MEMBER :button-1-motion :button-2-motion :button-3-motion
  3468.            :button-4-motion :button-5-motion :button-motion :button-press
  3469.            :button-release :colormap-change :enter-window :exposure
  3470.            :focus-change :key-press :key-release :keymap-state :leave-window
  3471.            :owner-grab-button :pointer-motion :pointer-motion-hint
  3472.            :property-change :resize-redirect :structure-notify
  3473.            :substructure-notify :substructure-redirect :visibility-change))
  3474.  
  3475. The type event-mask-class is a keyword name which corresponds to a
  3476. particular bit in an event bitmask.
  3477.  
  3478.  
  3479. (DEFTYPE event-mask ()
  3480.   '(OR mask32 (LIST event-mask-class)))
  3481.  
  3482. The type event-mask is a way to specify a set of bits for an event bitmask.
  3483. Two ways of specifying the bits are allowed.  By setting the event bits in a
  3484. 32 bit mask or by listing the keyword names of the event bits in a list.
  3485.  
  3486.  
  3487. (DEFTYPE pointer-event-mask-class ()
  3488.   '(MEMBER :button-1-motion :button-2-motion :button-3-motion
  3489.            :button-4-motion :button-5-motion :button-motion :button-press
  3490.            :button-release :enter-window :keymap-state :leave-window
  3491.            :pointer-motion :pointer-motion-hint))
  3492.  
  3493. The type pointer-event-mask-class is a keyword name, for a pointer related
  3494. event, which corresponds to a particular bit in an event bitmask.  The set
  3495. of names is a subset of the names in the type event-mask-class.
  3496.  
  3497.  
  3498. (DEFTYPE pointer-event-mask ()
  3499.   '(OR mask32 (LIST pointer-event-mask-class)))
  3500.  
  3501. The type pointer-event-mask is a way to specify a set of bits for an event
  3502. bitmask.  Two ways of specifying the bits are allowed.  By setting the event
  3503. bits in a 32 bit mask or by listing the keyword names of the pointer related
  3504. event bits in a list.
  3505.  
  3506.  
  3507. (DEFTYPE device-event-mask-class ()
  3508.   '(MEMBER :button-1-motion :button-2-motion :button-3-motion
  3509.            :button-4-motion :button-5-motion :button-motion :button-press
  3510.            :button-release :key-press :key-release :pointer-motion))
  3511.  
  3512. The type device-event-mask-class is a keyword name, for a device related
  3513. event, which corresponds to a particular bit in an event bitmask.  The set
  3514. of names is a subset of the names in the type event-mask-class.
  3515.  
  3516.  
  3517. (DEFTYPE device-event-mask ()
  3518.   '(OR mask32 (LIST device-event-mask-class)))
  3519.  
  3520. The type device-event-mask is a way to specify a set of bits for an event
  3521. bitmask.  Two ways of specifying the bits are allowed.  By setting the event
  3522. bits in a 32 bit mask or by listing the keyword names of the device related
  3523. event bits in a list.
  3524.  
  3525.  
  3526. (DEFUN window-all-event-masks (window)
  3527.   (DECLARE (TYPE window window)
  3528.            (VALUES all-event-masks)
  3529.            (TYPE mask32 all-event-masks)))
  3530.  
  3531. window  Specifies the window whose all-event-mask is to be returned.
  3532.  
  3533. This function returns the inclusive-OR of all event masks selected on the
  3534. specified window by clients.
  3535.  
  3536.  
  3537. (DEFUN make-event-mask (&rest keys)
  3538.   (DECLARE (TYPE (LIST event-mask-class) keys)
  3539.            (VALUES event-mask?)
  3540.            (TYPE mask32 event-mask?)))
  3541.  
  3542. keys    Keyword names for the event bits which are to be set in the event
  3543.         bitmask that is returned.
  3544.  
  3545. This function is useful for constructing an event mask from a set of keyword
  3546. names for the event bits.  This is only defined to work for core events.  An
  3547. event bitmask with the specified bits set is returned.
  3548.  
  3549.  
  3550. (DEFUN make-event-keys (event-mask)
  3551.   (DECLARE (TYPE mask32 event-mask)
  3552.            (VALUES event-keywords)
  3553.            (TYPE (LIST event-mask-class) event-keywords)))
  3554.  
  3555. event-mask
  3556.         Event bitmask which is to be decoded.
  3557.  
  3558. This function returns a list of keyword names for the event bits that are
  3559. set in the specified event bitmask.  This is only defined to work for core
  3560. events.
  3561.  
  3562.  
  3563. (DEFUN make-state-mask (&REST keys)
  3564.   (DECLARE (TYPE (LIST state-mask-key) keys)
  3565.        (VALUES mask)
  3566.            (TYPE mask16 mask))
  3567.  
  3568. Keys    is a list of keys that are to turned into 16-bit masks.
  3569.  
  3570. The make-state-mask function is useful for constructing a modifier-mask and
  3571. state-mask masks. The keys found in the list keys are read and returned as
  3572. 16-bit masks.
  3573.  
  3574. (DEFUN make-state-keys (state-mask)
  3575.   (DECLARE (TYPE mask16 mask)
  3576.        (VALUES return-list)
  3577.            (TYPE (LIST state-mask-key) return-list)))
  3578.  
  3579. state-mask
  3580.     Is a 16-bit mask of type mask16.
  3581.  
  3582. The make-state-key function takes the argument state-mask, and searches the
  3583. state-mask-key list for a match. If a match is found, the remaining portion of
  3584. the state-mask-key list is returned, otherwise NIL.
  3585.  
  3586.  
  3587. (DEFUN window-do-not-propagate-mask (window)
  3588.   (DECLARE (TYPE window window)
  3589.            (VALUES do-not-propagate-mask)
  3590.            (TYPE mask32 do-not-propagate-mask)))
  3591.  
  3592. Settable.
  3593.  
  3594. window  Specifies the window whose do-not-propagate-mask attribute is to be
  3595.         accessed.
  3596.  
  3597. Returns the value of the do-not-propagate-mask attribute for the specified
  3598. window.
  3599.  
  3600.  
  3601. (DEFUN window-event-mask (window)
  3602.   (DECLARE (TYPE window window)
  3603.            (VALUES event-mask?)
  3604.            (TYPE mask32 event-mask?)))
  3605.  
  3606. Settable.
  3607.  
  3608. window  Specifies the window whose event-mask attribute is to be accessed.
  3609.  
  3610. Returns the value of the event-mask attribute for the specified window.
  3611.  
  3612.  
  3613. 4.4.8.  Override-Redirect
  3614.  
  3615. To control window placement or to add decoration, a window manager often
  3616. needs to intercept ("redirect") any map or configure request.  Pop-up
  3617. windows, however, need to be mapped without a window manager getting in the
  3618. way for quick response.  You can control if a window is to ignore these
  3619. structure control facilities by use of the override-redirect mask.
  3620.  
  3621. The default value for the override-redirect attribute is :off.  The
  3622. override-redirect attribute specifies whether map and configure requests on
  3623. this window should override a :substructure-redirect on the parent.
  3624. Typically window managers use this information to avoid tampering with
  3625. pop-up windows.
  3626.  
  3627.  
  3628. (DEFUN window-override-redirect (window)
  3629.   (DECLARE (TYPE window window)
  3630.            (VALUES override-redirect)
  3631.            (TYPE (MEMBER :on :off) override-redirect)))
  3632.  
  3633. Settable.
  3634.  
  3635. window  Specifies the window whose override-redirect attribute is to be
  3636.         accessed.
  3637.  
  3638. Returns the value of the override-redirect attribute for the specified
  3639. window.
  3640.  
  3641.  
  3642. 4.4.9.  Colormap
  3643.  
  3644. The colormap attribute specifies which colormap, if any, best reflects the
  3645. true colors of the window.  The colormap must have the same visual type as
  3646. the window.  X servers capable of supporting multiple hardware colormaps may
  3647. use this information, and window managers may use it for install-colormap
  3648. requests (see section 6.4).  If you set the colormap attribute to :copy the
  3649. parent window's colormap is copied and used by its child.  The default value
  3650. for the colormap attribute is :copy.  Subsequent changes to the parent
  3651. window's colormap attribute do not affect the child window.  However, the
  3652. child window must have the same visual type as the parent.  The parent
  3653. window must not have a colormap attribute that is NIL.
  3654.  
  3655. The colormap is copied by sharing the colormap object between the child and
  3656. parent, not by making a complete copy of the colormap contents.
  3657.  
  3658.  
  3659. (DEFUN window-colormap (window)
  3660.   (DECLARE (TYPE window window)
  3661.            (VALUES colormap)
  3662.            (TYPE (OR NULL colormap) colormap)))
  3663.  
  3664. (DEFSETF window-colormap (window) (colormap)
  3665.   (DECLARE (TYPE window window)
  3666.            (TYPE (OR (MEMBER :copy) colormap) colormap)
  3667.            (VALUES colormap)
  3668.        (TYPE (OR NULL colormap) colormap)))
  3669.  
  3670. Settable.
  3671.  
  3672. window  Specifies the window whose colormap attribute is to be accessed.
  3673.  
  3674. Returns the value of the colormap attribute for the specified window.  A
  3675. value of :copy will never be returned, since the parent's colormap attribute
  3676. is actually copied, but the attribute may be set to :copy in a SETF form.
  3677. Changing the colormap of a window (defining a new map, not changing the
  3678. contents of the existing map) generates a :colormap-notify event.  Changing
  3679. the colormap of a visible window might have no immediate effect on the
  3680. screen (see install-colormap).
  3681.  
  3682.  
  3683. (DEFUN window-colormap-installed-p (window)
  3684.   (DECLARE (TYPE window window)
  3685.            (VALUES colormap-installed?)
  3686.            (TYPE boolean colormap-installed?)))
  3687.  
  3688. window  Specifies the window whose colormap state is to be returned.
  3689.  
  3690. This function returns non-null if the colormap associated with this window
  3691. is installed for the display.  Otherwise it returns NIL.
  3692.  
  3693.  
  3694. 4.4.10.  Cursor
  3695.  
  3696. If a cursor is specified, it will be used whenever the pointer is in the
  3697. window.  If :none is specified, the parent's cursor will be used when the
  3698. pointer is in the window, and any change in the parent's cursor will cause
  3699. an immediate change in the displayed cursor.  The default value for the
  3700. cursor attribute is :none.  The cursor may be freed immediately if no
  3701. further explicit reference to it is made by calling free-cursor.
  3702.  
  3703. The X protocol does not allow retrieval of the cursor attribute value for a
  3704. window.  It is only settable.  In other words, it is a write only value.
  3705.  
  3706.  
  3707. (DEFSETF window-cursor (window) (cursor)
  3708.   (DECLARE (TYPE window window)
  3709.            (TYPE (OR (MEMBER :none) cursor) cursor)
  3710.            (VALUES cursor?)
  3711.            (TYPE cursor cursor?)))
  3712.  
  3713. window  Specifies the window whose cursor attribute is to be set.
  3714.  
  3715. border  Specifies the new value for cursor attribute.  It may be a cursor or
  3716.         :none as described above.
  3717.  
  3718. This SETF operation changes the cursor attribute of the window to the value
  3719. specified.  Changing the cursor of a root window to :none restores the
  3720. default cursor.
  3721.  
  3722.  
  3723. (DEFUN cursor-equal (cursor-1 cursor-2)
  3724.    (DECLARE (TYPE cursor cursor-1 cursor-2)))
  3725.  
  3726. cursor-1
  3727. cursor-2    
  3728.     The cursor objects to be tested.
  3729.  
  3730. This function returns T if the two arguments are equivalent cursors and NIL if
  3731. they are not.
  3732.  
  3733.  
  3734. (DEFUN cursor-id (cursor)
  3735.    (DECLARE (TYPE cursor cursor)
  3736.         (VALUES id)
  3737.                (TYPE resource-id id)))
  3738.  
  3739. cursor    The cursor object to be accessed.
  3740.  
  3741. This function returns the unique resource-id that has been assigned to the
  3742. specified cursor by the server.
  3743.  
  3744.  
  3745. (DEFUN cursor-p (cursor)
  3746.    (DECLARE (TYPE cursor cursor)
  3747.         (VALUES boole)
  3748.         (TYPE boolean boole)))
  3749.  
  3750. cursor    The cursor object to be accessed.
  3751.  
  3752. This function returns a boolean; T if the argument is a cursor object and NIL
  3753. otherwise.
  3754.  
  3755.  
  3756. 4.4.11.  Font
  3757.  
  3758. ****more to be added here from font accessors...
  3759.  
  3760.  
  3761. A "font" is an array of glyphs (typically characters).  The protocol does no
  3762. translation or interpretation of character sets.  The client simply indicates
  3763. values used to index the glyph array.  A font contains additional metric
  3764. information to determine inter-glyph and inter-line spacing.
  3765.  
  3766.  
  3767.  
  3768. (DEFUN font-equal (font-1 font-2)
  3769.    (DECLARE (TYPE font font-1 font-2)))
  3770.  
  3771. font-1
  3772. font-2    The glyph arrays to be tested.
  3773.  
  3774. This function returns T if the two arguments are equivalent fonts and NIL if
  3775. they are not.
  3776.  
  3777.  
  3778. (DEFUN font-id (font)
  3779.    (DECLARE (TYPE font font)
  3780.         (VALUES id)
  3781.         (TYPE resource-id id)))
  3782.  
  3783. font     The glyph array which is to be accessed.
  3784.  
  3785. This function returns the unique resource-id that has been assigned to the
  3786. specified font by the server.
  3787.  
  3788.  
  3789. (DEFUN font-p (font)
  3790.    (DECLARE (TYPE font font)
  3791.         (VALUES boole)
  3792.         (TYPE boolean boole)))
  3793.  
  3794. font     The glyph array to be accessed.
  3795.  
  3796. This function returns a boolean; T if the argument is a font object and NIL
  3797. otherwise.
  3798.  
  3799. 4.4.12.  Atoms
  3800.  
  3801. In CLX, an "atom" is a unique ID corresponding to a symbol or string name.
  3802. Atoms are used to identify properties, types, and selections.
  3803.  
  3804.  
  3805. (Defun find-atom (display name)
  3806.   (DECLARE (TYPE display display)
  3807.        (TYPE xatom name)
  3808.        (VALUES atom-name)
  3809.            (TYPE (OR NULL card29) atom-name)))
  3810.  
  3811.  
  3812. display    Specifies the connection to the X server.
  3813.  
  3814. name    Specifies the name (string or symbol) associated with the atom you
  3815.     want returned.
  3816.  
  3817. Returns the atom-id associated with a given string or symbol name if it
  3818. exists, otherwise NIL.  The only-if-exists option in Xlib is not an option in
  3819. CLX.  If you want the atom to be created if it does not exist, use atom-name.
  3820. The string should use the ISO Latin-1 encoding.  Case matters: the strings
  3821. "thing", "Thing", and "thinG" all designate different atoms.  Symbols are
  3822. always uppercase.  The lifetime of an atom is not tied to the interning
  3823. client.  Atoms remained defined until the server is reset.  Note that the atom
  3824. identifier would have been previously obtained the by calling intern-atom.
  3825.  
  3826.  
  3827. (DEFUN intern-atom (display name)
  3828.   (DECLARE (TYPE display display)
  3829.        (TYPE xatom name)
  3830.        (VALUES atom-id)
  3831.            (TYPE card29 atom-id)))
  3832.  
  3833. display    Specifies the connection to the X server.
  3834.  
  3835. name    Specifies the name (string or symbol) associated with the atom you
  3836.     want returned.
  3837.  
  3838. The intern-atom function returns the atom identifier associated with the given
  3839. string name.  You should use a null-terminated ISO Latin-1 string for name.
  3840. Case matters: the strings "thing", "Thing", and "thinG" all designate
  3841. different atoms.  Symbols are always uppercase.  The atom will remain defined
  3842. even after the client who defined it has gone away.  It will become undefined
  3843. only when the last connection to the X server closes.
  3844.  
  3845.  
  3846. (DEFUN atom-name (display atom-ID)
  3847.   (DECLARE (TYPE display display)
  3848.        (TYPE card29 atom-id)
  3849.        (VALUES atom-name)
  3850.            (TYPE keyword atom-name)))
  3851.  
  3852. display    Specifies the connection to the X server.
  3853.  
  3854. atom-id    Specifies the atom-id associated with the keyword name you want
  3855.     returned.
  3856.  
  3857. The atom-name function returns the keyword name associated with the atom
  3858. identifier you passed as the atom-id argument.  Atoms are accepted as strings
  3859. or symbols, however, they are always returned as keywords.  If the atom does
  3860. not exist, atom-name will create it.  The only-if-exists option in Xlib is not
  3861. an option in CLX.  If a test is warranted to see if the atom exists, but its
  3862. creation is not desirable, use find-name.
  3863.  
  3864.  
  3865. 4.5.  Window Properties
  3866.  
  3867. Windows may have associated properties, consisting of a name, a type, a data
  3868. format, and some data.  The X Window System has a set of predefined
  3869. properties (for example, the name of a window, size hints, and so on), but
  3870. the protocol places no interpretation on properties, since they are intended
  3871. as a general purpose mechanism for clients to define arbitrary information
  3872. and associate it with windows.  For example, clients might share information
  3873. such as program names, documentation, and icon formats with a window manager
  3874. via properties.
  3875.  
  3876. For efficiency reasons atoms are used rather than a strings for the name and
  3877. type of a property.  The intern-atom function can be used to define or
  3878. obtain the atoms for new properties.  A property is stored in one of several
  3879. possible formats.  The X server can store the information as 8-bit
  3880. quantities, 16-bit quantities, or 32-bit quantities.  This permits the X
  3881. server to present the data in the byte order that the client expects.  The
  3882. type of a property is defined by other properties, which allows for
  3883. arbitrary extension in this type scheme.
  3884.  
  3885.                                       Note
  3886.  
  3887.      If you define further properties of complex types, you must write
  3888.      functions to encode and decode them yourself.  These functions must be
  3889.      carefully written if they are to be portable.  See Appendix ??  for
  3890.      further information about how to write such functions.
  3891.  
  3892. The predefined property names are:
  3893.  
  3894.         CUT_BUFFER0             RGB_GREEN_MAP
  3895.         CUT_BUFFER1             RGB_RED_MAP
  3896.         CUT_BUFFER2             RESOURCE_MANAGER
  3897.         CUT_BUFFER3             WM_CLASS
  3898.         CUT_BUFFER4             WM_CLIENT_MACHINE
  3899.         CUT_BUFFER5             WM_COMMAND
  3900.         CUT_BUFFER6             WM_HINTS
  3901.         CUT_BUFFER7             WM_ICON_NAME
  3902.         RGB_BEST_MAP            WM_ICON_SIZE
  3903.         RGB_BLUE_MAP            WM_NAME
  3904.         RGB_DEFAULT_MAP         WM_NORMAL_HINTS
  3905.         RGB_GRAY_MAP            WM_ZOOM_HINTS
  3906.                                 WM_TRANSIENT_FOR
  3907.  
  3908. The predefined property types are:
  3909.  
  3910.         ARC                     POINT
  3911.         ATOM                    RGB_COLOR_MAP
  3912.         BITMAP                  RECTANGLE
  3913.         CARDINAL                STRING
  3914.         COLORMAP                VISUALID
  3915.         CURSOR                  WINDOW
  3916.         DRAWABLE                WM_HINTS
  3917.         FONT                    WM_SIZE_HINTS
  3918.         INTEGER
  3919.         PIXMAP
  3920.  
  3921.  
  3922. CLX provides functions with which you can obtain, change, update, or
  3923. interchange a window property.  In addition, CLX provides other utility
  3924. functions for predefined property operations.  See Chapter ??  for further
  3925. information about predefined property functions.
  3926.  
  3927.  
  3928. (DEFUN change-property (window property data type format
  3929.                         &key (mode :replace) (start 0) end transform)
  3930.   (DECLARE (TYPE window window)
  3931.            (TYPE xatom property type)
  3932.            (TYPE (MEMBER 8 16 32) format)
  3933.            (TYPE (SEQUENCE INTEGER) data)
  3934.            (TYPE (MEMBER :append :prepend :replace) :mode)
  3935.            (TYPE array-index :start)
  3936.            (TYPE (OR NULL array-index) :end)
  3937.            (TYPE (OR NULL (FUNCTION (T) INTEGER)) :transform)))
  3938.  
  3939. w       Specifies the window whose property you want to change.
  3940.  
  3941. property
  3942.         Specifies the atom for the name of the property which is to be
  3943.         changed.  The property remains defined even after the client who
  3944.         defined it closes its connection.
  3945.  
  3946. data    Specifies the new data for the property.
  3947.  
  3948. type    Specifies the atom for the type of the property.  The X server does
  3949.         not interpret the type but simply passes it back in later calls to
  3950.         the get-property function.
  3951.  
  3952. format  Specifies whether the data should be viewed as a sequence of 8-bit,
  3953.         16-bit, or 32-bit quantities.  This information allows the X server
  3954.         to correctly perform byte-swap operations as necessary.  Possible
  3955.         values are 8, 16, and 32.
  3956.  
  3957. :mode   Optionally specifies the mode of the operation.  The possible values
  3958.         are :append, :prepend, and :replace.  The default value is :replace.
  3959.  
  3960. :start
  3961. :end    Optionally specifies the sub-sequence which is extracted from data
  3962.         sequence.  The default 0 for start and NIL for end which means to
  3963.         use the whole sequence.
  3964.  
  3965. :transform
  3966.         Optionally specifies a function which is to be applied to each
  3967.         extracted element from the data sequence.  The default is NIL which
  3968.         indicates that no transformation is done.
  3969.  
  3970. The change-property function alters the property for the specified window
  3971. and causes the X server to generate a property-notify event on that window.
  3972. It does the following according to the value you assign to the mode
  3973. argument:
  3974.  
  3975. o    If the mode argument is :replace, change-property discards the previous
  3976.      property value.
  3977.  
  3978. o    If the mode argument is :append or :prepend, the type and format must
  3979.      match the existing property value.  If the property is undefined, it is
  3980.      treated as if it is defined with the correct type and format and zero
  3981.      length data.  For :append, the function appends the data onto the end
  3982.      of the existing data.  For :prepend, the function inserts the data
  3983.      before the beginning of the existing data.
  3984.  
  3985. The lifetime of a property is not tied to the storing client.  Properties
  3986. remain until explicitly deleted, until the window is destroyed, or until the
  3987. server resets.  See Section 2.4 for a discussion of what happens when the
  3988. connection to the X server is closed.  The maximum size of a property is
  3989. server dependent and, depending on the amount of memory the server has
  3990. available, can vary dynamically.
  3991.  
  3992.  
  3993. (DEFUN delete-property (window property)
  3994.   (DECLARE (TYPE window window)
  3995.            (TYPE xatom property)))
  3996.  
  3997. window  Specifies the window whose property you want to delete.
  3998.  
  3999. property
  4000.         Specifies the atom for the name of the property which is to be
  4001.         deleted.  The property remains defined even after the client who
  4002.         defined it closes its connection.
  4003.  
  4004. The delete-property function deletes the specified property if the property
  4005. is defined on the specified window.  It causes the X server to generate a
  4006. property-notify event on the window, unless the property does not exist.
  4007.  
  4008.  
  4009. (DEFUN get-property (window property
  4010.                      &key type (start 0) end delete-p (result-type 'LIST)
  4011.                           transform)
  4012.   (DECLARE (TYPE window window)
  4013.            (TYPE xatom property)
  4014.            (TYPE (OR NULL xatom) :type)
  4015.            (TYPE array-index :start)
  4016.            (TYPE (OR NULL array-index) :end)
  4017.            (TYPE boolean :delete-p)
  4018.            (TYPE T :result-type)
  4019.            (TYPE (OR NULL (FUNCTION (INTEGER) T)) :transform)
  4020.            (VALUES data return-type format bytes-after)
  4021.        (TYPE (SEQUENCE INTEGER) data)
  4022.        (TYPE (OR NULL xatom) return-type)
  4023.        (TYPE card8 format)
  4024.        (TYPE card32 bytes-after)))
  4025.  
  4026. window  Specifies the window whose property data, type atom, and format you
  4027.         want to obtain.
  4028.  
  4029. property
  4030.         Specifies the atom for the name of the property which is to be
  4031.         retrieved.  The property remains defined even after the client who
  4032.         defined it closes its connection.
  4033.  
  4034. :type   Optionally specifies the atom for the property type.  The default is
  4035.         NIL which allows matching any property type.  ??
  4036.  
  4037. :start  Optionally specifies the starting offset in the property data (in
  4038.         32-bit quantities) where data will be retrieved.  The default is
  4039.         zero which starts at the beginning of the data.
  4040.  
  4041. :end    Specifies the ending offset in the specified property (in 32-bit
  4042.         quantities) where data will stop being retrieved.  This is one
  4043.         beyond the last 32-bit quantity retrieved.  The default is 64000
  4044.         which will include all the data for most properties.
  4045.  
  4046. :delete-p
  4047.         An optional boolean value that determines whether the property is
  4048.         deleted from the window after the data is completely retrieved.
  4049.         Non-null specifies that the property is to be deleted and NIL
  4050.         indicates that it is retained.  The default is NIL.
  4051.  
  4052. :result-type
  4053.         A keyword argument, that is a valid type specifier for a sub-type of
  4054.         SEQUENCE, indicating what kind of sequence should be created to
  4055.         return the data for this property.  The default is to return it in a
  4056.         list.
  4057.  
  4058. :transform
  4059.         Optionally specifies a function which is to be applied to each
  4060.         element of the property data that is retrieved and put into the
  4061.         sequence for the data return value.  The default is NIL which
  4062.         indicates that no transformation is done.
  4063.  
  4064. The get-property function returns the property data in a sequence, the atom
  4065. for the actual type of the property, the actual format of the property, and
  4066. the number of data bytes remaining to be read if a partial read was
  4067. performed as multiple values.  This function sets these return value
  4068. according to the following:
  4069.  
  4070. o    If the specified property does not exist for the specified window,
  4071.      get-property returns NIL for the data and type return values, and zero
  4072.      for the format and bytes-after return values.  In this case, the delete
  4073.      argument is ignored.
  4074.  
  4075. o    If the specified property exists, but its type does not match the
  4076.      specified type, get-property returns NIL for the data return value, the
  4077.      actual property type for the type return value, the actual property
  4078.      format (never zero) for the format return value, and the property
  4079.      length in bytes (even if the format return value is 16 or 32) for the
  4080.      bytes-after return value.  It also ignores the delete argument.
  4081.  
  4082. o    If the specified property exists, and either the type argument is NIL
  4083.      (??) or the specified type matches the actual property type,
  4084.      get-property returns the actual property type for the type return value
  4085.      and the actual property format (never zero) for the format return
  4086.      value.  It also returns a value for the bytes-after return value by
  4087.      defining the following values:
  4088.  
  4089.           N = actual length of the stored property in bytes
  4090.               (even if the format is 16 or 32)
  4091.           I = 4 * start
  4092.           T = N - I
  4093.           L = MINIMUM(T, 4 * (end - start))
  4094.           A = N - (I + L)
  4095.  
  4096.      The returned data starts at byte index I in the property (indexing from
  4097.      zero), and its length in bytes is L.  It is an error if end and start
  4098.      are specified such that L is negative.  The value of the bytes-after
  4099.      return value is A, which gives the number of trailing unread bytes in
  4100.      the stored property.
  4101.  
  4102.      If the delete argument is non-null and the bytes-after return value is
  4103.      zero the function deletes the property from the window and generates a
  4104.      property-notify event on the window.
  4105.  
  4106.  
  4107. (DEFUN rotate-properties (window properties &optional (delta 1))
  4108.   (DECLARE (TYPE window window)
  4109.            (TYPE (SEQUENCE xatom) properties)
  4110.            (TYPE int16 delta)))
  4111.  
  4112. window  Specifies the window whose property data, type atom, and format you
  4113.         want to obtain.
  4114.  
  4115. properties
  4116.         Specifies the sequence of atoms for the names of the properties
  4117.         which are to be rotated.  The properties remain defined even after
  4118.         the clients who defined them closes their connections.
  4119.  
  4120. delta   Specifies the rotation amount.
  4121.  
  4122. The rotate-properties function allows you to rotate the values for the
  4123. specified properties and causes the X server to generate a property-notify
  4124. event.  If the properties specified in the sequence are viewed as being
  4125. numbered starting from zero with N property name atoms in the sequence, then
  4126. the value associated with property I becomes the value associated with
  4127. property ((I + delta) MOD N), for all I from zero to (N - 1).  The effect is
  4128. to rotate the values of the properties by delta places around the virtual
  4129. ring of properties.  The rotation is to the left for positive values of
  4130. delta, and right for negative values of delta (this is the opposite of
  4131. actual X protocol request).  If (delta MOD N) is non-zero, the X server
  4132. generates a property-notify event for each property in the order that they
  4133. are listed in the sequence.  It is an error if a property name atom occurs
  4134. more than once in the sequence or no property with that name is defined for
  4135. the window and no properties are changed.
  4136.  
  4137.  
  4138. (DEFUN list-properties (window &key (result-type 'LIST))
  4139.   (DECLARE (TYPE window window)
  4140.            (TYPE T :result-type)
  4141.            (VALUES properties)
  4142.            (TYPE (SEQUENCE KEYWORD) properties)))
  4143.  
  4144. window  Specifies the window whose property list you want to obtain.
  4145.  
  4146. :result-type
  4147.         A keyword argument, that is a valid type specifier for a sub-type of
  4148.         SEQUENCE, indicating what kind of sequence should be created to
  4149.         return the properties for the specified window.  The default is to
  4150.         return them in a list.
  4151.  
  4152. The list-properties function returns a sequence of keywords for the names of
  4153. the properties that are defined for the specified window.
  4154.  
  4155.  
  4156. 4.6.  Window Selections
  4157.  
  4158. Selections are one method for applications to exchange data.  By using the
  4159. property mechanism, applications can exchange data of arbitrary types and
  4160. can negotiate the type of the data.  A selection can be thought of as an
  4161. indirect property with a dynamic type.  That is, rather than having the
  4162. property stored in the X server, the property is maintained by some client
  4163. (the owner).  A selection is global in nature, being thought of as belonging
  4164. to the user but maintained by clients, rather than being private to a
  4165. particular window subhierarchy or a particular set of clients.
  4166.  
  4167. Selections are communicated from an owner client to a requestor client.  The
  4168. owner has the data for the value of the selection, and the requestor
  4169. receives it.  A requestor wishing to obtain the value for a selection
  4170. provides:
  4171.  
  4172. o    The name of the selection.
  4173.  
  4174. o    The name of a property.
  4175.  
  4176. o    A window.
  4177.  
  4178. o    An atom representing the data type required.
  4179.  
  4180. If the selection is currently owned, the owner receives an event, and is
  4181. expected to:
  4182.  
  4183. o    Convert the contents of the selection to the requested data type.
  4184.  
  4185. o    Place this data in the named property on the named window.
  4186.  
  4187. o    Send the requestor an event to let it know the property is available.
  4188.  
  4189. Note that all data transferred between an owner and a requestor must
  4190. normally go via the server.  A client cannot assume that another client can
  4191. open the same files, ore even communicate directly.  The other client may be
  4192. be communicating with the server via a completely different networking
  4193. mechanism.  Thus, passing indirect references to data such as file names,
  4194. host names, and port numbers is permitted only if both clients specifically
  4195. agree.
  4196.  
  4197. CLX provides functions with which you can set, get, or request conversion of
  4198. window selections.  This allows applications to implement the notion of
  4199. current selection, which requires notification be sent to applications when
  4200. they no longer own the selection.  Applications that support selection often
  4201. highlight the current selection and need to be able to be informed when some
  4202. other application has acquired the selection in order to be able to
  4203. unhighlight the selection.
  4204.  
  4205. When a client asks for the contents of a selection, it specifies a selection
  4206. target type.  This target type can be used to control the transmitted
  4207. representation of the contents.  For example, if the selection is "the last
  4208. thing the user clicked on", and that is currently an image, then the target
  4209. type might specify whether the contents of the image should be sent in
  4210. XYFormat or ZFormat.
  4211.  
  4212. The target type can also be used to control the class of the contents that
  4213. are transmitted.  For example, a client could ask for the "looks" (fonts,
  4214. line spacing, indentation, and so forth) of a paragraph selection, instead
  4215. of the text of the paragraph.  The target type can also be used for other
  4216. purposes.  The semantics are not constrained by the protocol.
  4217.  
  4218.  
  4219. (DEFUN selection-owner (display selection)
  4220.   (DECLARE (TYPE display display)
  4221.            (TYPE xatom selection)
  4222.            (VALUES owner)
  4223.            (TYPE (OR NULL window) owner)))
  4224.  
  4225. Settable (see below).
  4226.  
  4227. display Specifies the display connection to the X server for the selection
  4228.         whose owner is being accessed.
  4229.  
  4230. selection
  4231.         Specifies the atom that names the selection whose owner you want
  4232.         returned.
  4233.  
  4234. The selection-owner function returns the window that currently owns the
  4235. specified selection.  If NIL is returned then there is no owner for the
  4236. selection.
  4237.  
  4238.  
  4239. (DEFUN set-selection-owner (display selection owner &optional time)
  4240.   (DECLARE (TYPE display display)
  4241.            (TYPE xatom selection)
  4242.            (TYPE timestamp time)
  4243.            (TYPE (OR NULL window) owner)
  4244.            (VALUES owner)
  4245.        (TYPE (OR NULL window) owner)))
  4246.  
  4247. (DEFSETF selection-owner (display selection &optional time) (owner)
  4248.   (DECLARE (TYPE display display)
  4249.            (TYPE xatom selection)
  4250.            (TYPE timestamp time)
  4251.            (TYPE (OR NULL window) owner)
  4252.            (VALUES owner)
  4253.        (TYPE (OR NULL window) owner)))
  4254.  
  4255. display Specifies the display connection to the X server for the selection
  4256.         whose owner is being set.
  4257.  
  4258. selection
  4259.         Specifies the atom that names the selection whose owner you want to
  4260.         set.
  4261.  
  4262. owner   Specifies the new owner of the specified selection.  You may specify
  4263.         a window or NIL for no owner.
  4264.  
  4265. time    Specifies the new last change time for the specified selection.  You
  4266.         can pass either a timestamp, expressed in milliseconds, or NIL which
  4267.         indicates the current time.
  4268.  
  4269. The set-selection-owner function (OR the equivalent SETF form) changes the
  4270. owner and last change time for the specified selection.  If the owner window
  4271. is specified as NIL, then the owner of the selection becomes NIL (that is,
  4272. no owner).  Otherwise, the owner of the selection becomes the window
  4273. specified.  A client must use a window which it created, since an event will
  4274. be used to reply.
  4275.  
  4276. The operation has no effect if the value you pass to the time argument is
  4277. earlier than the current last-change time of the specified selection or is
  4278. later than the current X server time.  Otherwise, the last-change time is
  4279. set to the specified time, with NIL being replaced by the current server
  4280. time.  This time value will normally be obtained from the timestamp of the
  4281. event triggering the acquisition of the selection.  Clients should not set
  4282. the time value to NIL (current server time), since if they do they have no
  4283. way of finding when they gained ownership of the selection.
  4284.  
  4285. If the new owner (whether a window or NIL) is not the same as the current
  4286. owner of the selection, and the current owner is not NIL, the current owner
  4287. is sent a selection-clear event.  If the client that is the owner of a
  4288. selection is later terminated (that is, its connection is closed) or if the
  4289. owner window it has specified in the request is later destroyed, the owner
  4290. of the selection automatically reverts to NIL, but the last-change time is
  4291. not affected.  The atom that names the selection is uninterpreted by the X
  4292. server.  The owner window of a selection can be retrieved by the
  4293. selection-owner function and is reported in selection-request and
  4294. selection-clear events.  Selections are global to the X server.
  4295.  
  4296.  
  4297. (DEFUN convert-selection (selection type requestor &optional property time)
  4298.   (DECLARE (TYPE xatom selection type)
  4299.            (TYPE window requestor)
  4300.            (TYPE (OR NULL xatom) property)
  4301.            (TYPE timestamp time)))
  4302.  
  4303. selection
  4304.         Specifies the atom that names the selection which you want to
  4305.         convert.
  4306.  
  4307. type    Specifies the atom for the target data type that the selection is to
  4308.         be converted to.
  4309.  
  4310. requestor
  4311.         Specifies the window which is requesting the conversion of the
  4312.         selection.  This is the window that the property, which contains the
  4313.         converted selection data, is placed on.
  4314.  
  4315. property
  4316.         Specifies the atom that names the property where the converted
  4317.         selection data is placed.  You also can pass NIL in which case the
  4318.         owner will choose a property.
  4319.  
  4320. time    Specifies the new last change time for the specified selection.  You
  4321.         can pass either a timestamp, expressed in milliseconds, or NIL which
  4322.         indicates the current time.
  4323.  
  4324. The convert-selection function requests that a selection be converted to the
  4325. specified target type and placed on the specified property:
  4326.  
  4327. o    If the specified selection has an owner, the X server sends a
  4328.      selection-request event to that owner.
  4329.  
  4330. o    If no owner for the specified selection exists, the X server generates
  4331.      a selection-notify event to the requestor with property NIL.  The
  4332.      arguments are passed on unchanged in either event.
  4333.  
  4334. There are two predefined selection atoms: "PRIMARY" and "SECONDARY".  See
  4335. Chapter ??  for more information on events, and in particular the
  4336. selection-notify event.
  4337.  
  4338.  
  4339. 4.7.  Window Stacking Order
  4340.  
  4341. Sibling windows may "stack" on top of each other.  Windows above both
  4342. obscure and occlude lower windows.  This is similar to paper on a desk.
  4343. This relationship between sibling windows is known as the stacking order.
  4344.  
  4345. CLX provides functions with which you can raise or lower children of a
  4346. window.  If the windows are regarded as overlapping sheets of paper stacked
  4347. on a desk, then raising a window is analogous to moving the sheet to the top
  4348. of the stack while leaving its x and y location on the desk constant, and
  4349. lowering a window is analogous to moving the sheet to the bottom of the
  4350. stack while leaving its x and y location on the desk constant.  Raising a
  4351. mapped window may generate exposure events for the window and any mapped
  4352. subwindows that were formerly obscured and lowering a mapped window will
  4353. generate exposure events on any windows it formerly obscured.
  4354.  
  4355.  
  4356. (DEFUN circulate-window-down (window)
  4357.   (DECLARE (TYPE window window)))
  4358.  
  4359. window  The window whose child window is to be lowered.
  4360.  
  4361. The circulate-window-down function lowers the highest mapped child of the
  4362. specified window that partially or completely occludes another child to the
  4363. bottom of the stack.  Completely unobscured children are not affected.
  4364. Exposure processing is performed on formerly obscured windows.
  4365.  
  4366. If some other client has selected substructure-redirect on the window, then
  4367. a circulate-request event is generated, and no further processing is
  4368. performed.  Otherwise, the child window is lowered and a circulate-notify
  4369. event is generated if the window is actually restacked.
  4370.  
  4371.  
  4372. (DEFUN circulate-window-up (window)
  4373.   (DECLARE (TYPE window window)))
  4374.  
  4375. window  The window whose child window is to be raised.
  4376.  
  4377. The circulate-window-up function raises the lowest mapped child of the
  4378. specified window that is partially or completely occluded by another child
  4379. to the top of the stack.  Completely unobscured children are not affected.
  4380. Exposure processing is performed on formerly obscured windows.
  4381.  
  4382. If some other client has selected substructure-redirect on the window, then
  4383. a circulate-request event is generated, and no further processing is
  4384. performed.  Otherwise, the child window is raised and a circulate-notify
  4385. event is generated if the window is actually restacked.
  4386.  
  4387.  
  4388. 4.8.  Window Hierarchy
  4389.  
  4390. All the windows in X are arranged in a strict hierarchy.  At the top of the
  4391. hierarchy are the root windows, which cover the display screens.  Each root
  4392. window is partially or completely covered by its child windows.  All
  4393. windows, except for root windows, have parents.  Child windows may in turn
  4394. have their own children.  In this way, a tree of arbitrary depth on each
  4395. screen can be created.  CLX provides several functions for examining and
  4396. modifying the window hierarchy.
  4397.  
  4398.  
  4399. (DEFUN drawable-root (drawable)
  4400.   (DECLARE (TYPE drawable drawable)
  4401.            (VALUES root-window?)
  4402.            (TYPE window root-window?)))
  4403.  
  4404. drawable
  4405.         The drawable whose root is to be returned.
  4406.  
  4407. This function returns the root window of the specified drawable.
  4408.  
  4409.  
  4410. (DEFUN query-tree (window &key (result-type 'LIST))
  4411.   (DECLARE (TYPE window window)
  4412.            (TYPE T :result-type)
  4413.            (VALUES children parent root)
  4414.            (TYPE (SEQUENCE window) children)
  4415.            (TYPE (OR NULL window) parent)
  4416.            (TYPE window root)))
  4417.  
  4418. window  The window whose tree is to be returned.  For this window, you
  4419.         obtain the sequence of its children, its parent, and its root as
  4420.         multiple values.
  4421.  
  4422. :result-type
  4423.         A keyword argument, that is a valid type specifier for a sub-type of
  4424.         SEQUENCE, indicating what kind of sequence should be created to
  4425.         return the children of the specified window.  The default is to
  4426.         return them in a list.
  4427.  
  4428. The query-tree function returns the children windows, the parent window, and
  4429. the root window for the specified window.  The children are returned in
  4430. current stacking order, from bottom-most (FIRST) to top-most (LAST).
  4431.  
  4432.  
  4433. (DEFUN reparent-window (window parent x y)
  4434.   (DECLARE (TYPE window window parent)
  4435.            (TYPE int16 x y)))
  4436.  
  4437. window  Specifies the window which is to have its parent changed.
  4438.  
  4439. parent  Specifies the new parent for the specified window.
  4440.  
  4441. x
  4442. y       Specifies the x and y coordinates at which the specified window
  4443.         should be positioned in its new parent.  These coordinates are
  4444.         relative to the parent's origin, and specify the new position of the
  4445.         upper left outer corner of the window.
  4446.  
  4447. The reparent-window function changes a window's parent within a single
  4448. screen.  There is no way to move a window between screens.
  4449.  
  4450. The specified window is reparented by inserting it as a child of the
  4451. specified parent.  If the window is mapped an unmap-window operation is
  4452. automatically performed on the specified window.  The window is then removed
  4453. from its current position in the hierarchy and inserted as the child of the
  4454. specified parent.  The window is placed on top in the stacking order with
  4455. respect to sibling windows.
  4456.  
  4457. After reparenting the specified window a reparent-notify event is generated.
  4458. The override-redirect attribute of the window is passed on in this event.
  4459. Window manager clients normally should ignore this event if this attribute
  4460. is :on.  See Chapter ??  for more information on reparent-notify event
  4461. processing.  Finally, if the specified window was originally mapped, a
  4462. map-window operation is automatically performed on it.
  4463.  
  4464. The X server performs normal exposure processing on formerly obscured
  4465. windows.  It might not generate exposure events for regions from the initial
  4466. unmap-window operation if they are immediately obscured by the final
  4467. map-window operation.
  4468.  
  4469. It is an error if any of the following are true:
  4470.  
  4471. o    The new parent window is not on the same screen as the old parent
  4472.      window.
  4473.  
  4474. o    The new parent window is the specified window or an inferior of the
  4475.      specified window.
  4476.  
  4477. o    If the specified window has a :parent-relative background attribute and
  4478.      if the new parent window is not the same depth as the specified window.
  4479.  
  4480.  
  4481. 4.9.  Translating Window Coordinates
  4482.  
  4483. Applications, mostly window managers, often need to perform a coordinate
  4484. transformation from the coordinate space of one window to another window or
  4485. need to determine which subwindow a coordinate lies in.  CLX provides a
  4486. function that fulfills these needs and avoids any race conditions by asking
  4487. the X server to perform this operation.
  4488.  
  4489.  
  4490. (DEFUN translate-coordinates (src src-x src-y dst)
  4491.   (DECLARE (TYPE window src dst)
  4492.            (TYPE int16 src-x src-y)
  4493.            (VALUES dst-x dst-y child)
  4494.            (TYPE (OR NULL int16) dst-x dst-y)
  4495.            (TYPE (OR NULL window) child)))
  4496.  
  4497. src     Specifies the source window which the coordinates are relative too.
  4498.  
  4499. src-x
  4500. src-y   Specify the x and y coordinates, within the source window, which are
  4501.         to be translated.
  4502.  
  4503. dst     Specifies the destination window whose coordinate space the
  4504.         coordinates are to translated to.
  4505.  
  4506. The translate-coordinates function takes the src-x and src-y coordinates
  4507. within the source window, relative to the source window's origin and returns
  4508. these coordinates relative to the destination window's origin as the first
  4509. values.  If the coordinates are contained in a mapped child of the
  4510. destination window, that child is returned as the third value.  If the
  4511. source and destination windows are not on the same screen, NIL is returned.
  4512.  
  4513.  
  4514. 4.10.  Mapping Windows
  4515.  
  4516. A window is considered mapped if a map-window call has been made on it.
  4517. When windows are first created, they are not mapped because an application
  4518. may wish to create a window long before it is mapped to the screen.  A
  4519. mapped window may not be visible on the screen for one of the following
  4520. reasons:
  4521.  
  4522. o    It is obscured by another opaque sibling window.
  4523.  
  4524. o    One of its ancestors is not mapped.
  4525.  
  4526. o    It is entirely clipped by an ancestor.
  4527.  
  4528. Any output to a window not visible on the screen will be discarded.
  4529. Exposure events will be generated for the window when part or all of it
  4530. becomes visible on the screen.  A client will only receive the exposure
  4531. events if it has asked for them.  Windows retain their position in the
  4532. stacking order when unmapped.
  4533.  
  4534. A window manager may want to control the placement of subwindows.  If
  4535. substructure-redirect has been selected by a window manager on a parent
  4536. window (usually a root window), a map request initiated by other clients on
  4537. a child window is not performed, and the window manager would be sent a
  4538. map-request event.  However, if the override-redirect attribute on the child
  4539. had been set to :on (usually only on pop-up menus), the map request would be
  4540. performed.
  4541.  
  4542. A tiling window manager might decide to reposition and resize other client's
  4543. windows and then decide to map the window at its final location.  A window
  4544. manager that wants to provide decoration might reparent the child into a
  4545. frame first.  Only a single client at a time can select
  4546. substructure-redirect.
  4547.  
  4548. Similarly, a single client can select resize-redirect on a parent window.
  4549. Then, any attempt to resize the window is suppressed, and the client
  4550. (usually, a window manager) receives a resize-request event.  These
  4551. mechanisms allow arbitrary placement policy to be enforced by an external
  4552. window manager.
  4553.  
  4554.  
  4555. (DEFUN map-window (window)
  4556.   (DECLARE (TYPE window window)))
  4557.  
  4558. window  Specifies the window which is to be mapped.
  4559.  
  4560. The map-window function maps the window and all of its subwindows which have
  4561. had map requests.  A subwindow will appear on the screen as long as all of
  4562. its ancestors are mapped and not obscured by a sibling or are not clipped by
  4563. an ancestor.  Mapping a window that has an unmapped ancestor does not
  4564. display the window but marks it as eligible for display when the ancestor
  4565. becomes mapped.  Such a window is called unviewable.  When all its ancestors
  4566. are mapped, the window becomes viewable and will be visible on the screen if
  4567. it is not obscured by any sibling or ancestor.  This function has no effect
  4568. if the window is already mapped.
  4569.  
  4570. If the override-redirect attribute of the window is :off, and if some other
  4571. client has selected substructure-redirect on the parent window, then the X
  4572. server generates a map-request event, and the map-window function does not
  4573. map the window.  Otherwise, the window is mapped, and the X server generates
  4574. a map-notify event.
  4575.  
  4576. If the window becomes viewable and no earlier contents for it are
  4577. remembered, map-window tiles the window with its background.  If no
  4578. background was defined for the window, the existing screen contents are not
  4579. altered, and the X server generates one or more expose events.  If a
  4580. backing-store was maintained while the window was unmapped, no expose events
  4581. are generated.  If a backing-store will now be maintained, a full window
  4582. exposure is always generated.  Otherwise, only visible regions may be
  4583. reported.  Similar tiling and exposure take place for any newly viewable
  4584. inferiors.
  4585.  
  4586. If the window is an input-output window, map-window generates expose events
  4587. on each input-output window that it causes to become displayed.  If the
  4588. client maps and paints the window, and if the client begins processing
  4589. events, the window will be painted twice.  To avoid this, the client should
  4590. request exposure events, map the window, and process input events normally.
  4591. The event list will include expose for each window that has appeared on the
  4592. screen.  The client's normal response to an expose event should be to
  4593. repaint the window.  This method usually leads to simpler programs and to
  4594. proper interaction with window managers.
  4595.  
  4596.  
  4597. (DEFUN map-subwindows (window)
  4598.   (DECLARE (TYPE window window)))
  4599.  
  4600. window  Specifies the window whose subwindows are to be mapped.
  4601.  
  4602. The map-subwindows function maps all subwindows for a specified window in
  4603. top-to-bottom stacking order.  The X server generates an expose event on
  4604. each newly displayed window.  This is much more efficient than mapping many
  4605. windows one at a time, because the server needs only perform much of the
  4606. work once for all of the windows rather than for each window.
  4607.  
  4608.  
  4609. (DEFUN window-map-state (window)
  4610.   (DECLARE (TYPE window window)
  4611.            (VALUES map-state)
  4612.            (TYPE (MEMBER :unmapped :unviewable :viewable) map-state)))
  4613.  
  4614. window  Specifies the window whose map state is to be returned.
  4615.  
  4616. This function returns the map state of the specified window.  A window is
  4617. :unviewable if it is mapped but some ancestor is unmapped.
  4618.  
  4619.  
  4620. 4.11.  Unmapping Windows
  4621.  
  4622. CLX provides functions with which you can unmap a window or all subwindows.
  4623. Windows retain their position in the stacking order when unmapped.
  4624.  
  4625.  
  4626. (DEFUN unmap-window (window)
  4627.   (DECLARE (TYPE window window)))
  4628.  
  4629. window  Specifies the window which is to be unmapped.
  4630.  
  4631. The unmap-window function unmaps the specified window and causes the X
  4632. server to generate an unmap-notify event.  If the specified window is
  4633. already unmapped, unmap-window has no effect.  Normal exposure processing on
  4634. formerly obscured windows is performed.  Any child window will no longer be
  4635. visible until another map call is made on the parent.  In other words, the
  4636. subwindows are still mapped but not visible until the parent is mapped.
  4637. Unmapping a window will generate exposure events on windows that were
  4638. formerly obscured by it and its children.
  4639.  
  4640.  
  4641. (DEFUN unmap-subwindows (window)
  4642.   (DECLARE (TYPE window window)))
  4643.  
  4644. window  Specifies the window whose subwindows are to be unmapped.
  4645.  
  4646. The unmap-subwindows function unmaps all subwindows for the specified window
  4647. in bottom to top stacking order.  It causes the X server to generate an
  4648. unmap-notify event on each subwindow and exposure events on formerly
  4649. obscured windows.  Using this function is much more efficient than unmapping
  4650. multiple windows one at a time, because the server needs only perform much
  4651. of the work once for all of the windows rather than for each window.
  4652.  
  4653.  
  4654. 4.12.  Destroying Windows
  4655.  
  4656. CLX provides functions with which you can destroy a window or destroy all
  4657. subwindows of a window.
  4658.  
  4659.  
  4660. (DEFUN destroy-window (window)
  4661.   (DECLARE (TYPE window window)))
  4662.  
  4663. window  Specifies the window which is to be destroyed.
  4664.  
  4665. The destroy-window function destroys the specified window as well as all of
  4666. its subwindows and causes the X server to generate a destroy-notify event
  4667. for each window.  The window should never again be referenced.  If the
  4668. specified window is mapped, it is unmapped automatically.  The window and
  4669. all of its inferiors are then destroyed, and a destroy-notify event is
  4670. generated for each window.  The ordering of the destroy-notify events is
  4671. such that for any given window being destroyed, destroy-notify is generated
  4672. on any inferiors of the window before being generated on the window itself.
  4673. The ordering among siblings and across sub-hierarchies is not otherwise
  4674. constrained.  If the window you specified is a root window, no windows are
  4675. destroyed.  Destroying a mapped window will generate exposure events on
  4676. other windows that were obscured by the window being destroyed.
  4677.  
  4678.  
  4679. (DEFUN destroy-subwindows (window)
  4680.   (DECLARE (TYPE window window)))
  4681.  
  4682. window  Specifies the window whose subwindows are to be destroyed.
  4683.  
  4684. The destroy-subwindows function destroys all inferior windows of the
  4685. specified window, in bottom to top stacking order.  It causes the X server
  4686. to generate a destroy-notify event for each window.  If any mapped
  4687. subwindows were actually destroyed, destroy-subwindows causes the X sever to
  4688. generate exposure events on the specified window.  This is much more
  4689. efficient than deleting many windows one at a time because much of the work
  4690. need only be performed once for all of the windows rather than for each
  4691. window.  The subwindows should never again be referenced.  Note that by
  4692. default, windows are destroyed when a connection is closed.  See section 2.4
  4693. for more information.
  4694.  
  4695.  
  4696.  
  4697.                   Chapter 5
  4698.  
  4699.                               Graphic Contexts
  4700.  
  4701.  
  4702. Most information about performing graphics (for example, foreground color,
  4703. background color, line style, and so on) are stored in resources called
  4704. graphic contexts.  Most graphic operations (see chapter 7) take a graphic
  4705. context (also referred to as a GContext, or GC) as an argument and use the
  4706. values in it to control the actual graphic operation.  In addition,
  4707. extensions to X may add additional components to graphic contexts.
  4708.  
  4709. CLX implements a write back cache for all elements of a graphic context that
  4710. are not resource identifiers to allow it to implement the transparent
  4711. coalescing of changes.  For example, a SETF of the foreground element in a
  4712. graphic context followed by a SETF of the line-style element will result in
  4713. only a single ChangeGC protocol request to the server.  Since graphic contexts
  4714. are neither expected nor encouraged to be shared between client applications
  4715. this caching should present no problems.  Applications cannot share graphic
  4716. contexts without external synchronization.  Therefore, sharing graphic
  4717. contexts between applications is highly discouraged.
  4718.  
  4719. For optimum performance, you should draw as much as possible with the same
  4720. graphic context (without changing its components).  The costs of changing
  4721. components relative to using different graphic contexts depends upon the
  4722. display hardware and the server implementation.  In addition, it is quite
  4723. likely that some amount of graphic context information will be cached in the
  4724. server and that a server can only cache a small number of graphic contexts.
  4725.  
  4726. This chapter explains of the CLX functions you can use to:
  4727.  
  4728. o    Create graphic contexts
  4729.  
  4730. o    Obtain information about a graphic context
  4731.  
  4732. o    Change elements of a graphic context
  4733.  
  4734. o    Copy a graphic context
  4735.  
  4736. o    Free a graphic context
  4737.  
  4738.  
  4739. 5.1.  Creating Graphic Contexts
  4740.  
  4741.  
  4742. (DEFUN create-gcontext (&key arc-mode background (cache-p t) cap-style
  4743.                              clip-mask clip-ordering clip-x clip-y
  4744.                              dash-offset dashes drawable exposures
  4745.                              fill-rule fill-style font foreground function
  4746.                              join-style line-style line-width plane-mask
  4747.                              stipple subwindow-mode tile ts-x ts-y)
  4748.   (DECLARE (TYPE (OR NULL (MEMBER :chord :pie-slice)) :arc-mode)
  4749.            (TYPE (OR NULL pixel) :background :foreground :plane-mask)
  4750.            (TYPE boolean :cache)
  4751.            (TYPE (OR NULL (MEMBER :unsorted :y-sorted :yx-banded
  4752.                                   :yx-sorted))
  4753.                  :clip-ordering)
  4754.            (TYPE (OR NULL (MEMBER :butt :not-last :projecting :round))
  4755.                  :cap-style)
  4756.            (TYPE (OR NULL (MEMBER :none) pixmap rect-seq) :clip-mask)
  4757.            (TYPE (OR NULL int16) :clip-x :clip-y :ts-x :ts-y)
  4758.            (TYPE (OR NULL card16) :dash-offset :line-width)
  4759.            (TYPE (OR NULL (OR card8 (SEQUENCE card8))) :dashes)
  4760.            (TYPE drawable drawable)
  4761.            (TYPE (OR NULL (MEMBER :off :on)) :exposures)
  4762.            (TYPE (OR NULL (MEMBER :even-odd :winding)) :fill-rule)
  4763.            (TYPE (OR NULL (MEMBER :opaque-stippled :solid :stippled :tiled))
  4764.                  :fill-style)
  4765.            (TYPE (OR NULL fontable) :font)
  4766.            (TYPE (OR NULL boole-constant) :function)
  4767.            (TYPE (OR NULL (MEMBER :bevel :miter :round)) :join-style)
  4768.            (TYPE (OR NULL (MEMBER :dash :double-dash :solid)) :line-style)
  4769.            (TYPE (OR NULL pixmap) :stipple :tile)
  4770.            (TYPE (OR NULL (MEMBER :clip-by-children :include-inferiors))
  4771.                  :subwindow-mode)
  4772.            (VALUES gcontext?)
  4773.            (TYPE gcontext gcontext?)))
  4774.  
  4775. :cache  Specifies if this graphic context should be cached locally by CLX.
  4776.         If NIL then the state is not cached, otherwise a local cache will be
  4777.         kept.  The default is to keep a local cache.
  4778.  
  4779. :drawable
  4780.         Specifies the drawable whose root and depth are to be associated
  4781.         with this graphic context.  This is a required keyword argument.
  4782.  
  4783. :arc-mode
  4784. :background
  4785. :cap-style
  4786. :clip-mask
  4787. :clip-ordering
  4788. :clip-x
  4789. :clip-y
  4790. :dash-offset
  4791. :dashes
  4792. :exposures
  4793. :fill-rule
  4794. :fill-style
  4795. :font
  4796. :foreground
  4797. :function
  4798. :join-style
  4799. :line-style
  4800. :line-width
  4801. :plane-mask
  4802. :stipple
  4803. :subwindow-mode
  4804. :tile
  4805. :ts-x
  4806. :ts-y   Specifies the values for the elements of the graphic context which
  4807.         are to be set at creation time.  Only the non-null attributes are
  4808.         passed on in the request, but for effective caching assumptions are
  4809.         made about what the actual protocol defaults are.  See Section 5.3
  4810.         for further information on the graphic context elements.
  4811.  
  4812. The create-gcontext function creates, initializes, and returns a graphic
  4813. context.  The graphic context can be used with any destination drawable
  4814. having the same root and depth as the specified drawable.  It is an error to
  4815. use it with other drawables.
  4816.  
  4817. All of the graphic context components are set to the values that are
  4818. specified by the keyword arguments, except that a value of NIL causes the
  4819. default value to be used.  These default values are as follows:
  4820.  
  4821.   -------------------------------------------------------------------------
  4822.   Component             Default Value
  4823.   -------------------------------------------------------------------------
  4824.   arc-mode              :pie-slice
  4825.   background            1
  4826.   cap-style             :butt
  4827.   clip-mask             :none
  4828.   clip-ordering         :unsorted
  4829.   clip-x                0
  4830.   clip-y                0
  4831.   dash-offset           0
  4832.   dashes                4 (that is, the list [4, 4])
  4833.   exposures             :on
  4834.   fill-rule             :even-odd
  4835.   fill-style            :solid
  4836.   font                  <implementation dependent>
  4837.   foreground            0
  4838.   function              BOOLE-1
  4839.   join-style            :miter
  4840.   line-style            :solid
  4841.   line-width            0
  4842.   plane-mask            All ones
  4843.   stipple               Pixmap of unspecified size filled with ones
  4844.   subwindow-mode        :clip-by-children
  4845.   tile                  Pixmap of an unspecified size filled with the
  4846.                         foreground pixel (that is, the client specified
  4847.                         pixel if any, else 0)
  4848.   ts-x                  0
  4849.   ts-y                  0
  4850.   -------------------------------------------------------------------------
  4851.  
  4852. Note that foreground and background do not default to any values that are
  4853. likely to be useful on a color display.  Since specifying a NIL value means
  4854. use the default, this implies for clip-mask that an empty rectangle sequence
  4855. cannot be specified as an empty list, :none must be used instead.
  4856. Specifying a stringable for font will cause an implicit open-font call to
  4857. occur.
  4858.  
  4859. If cache-p is non-null, then the graphic context state is cached locally,
  4860. and changing a component will have no effect unless the new value differs
  4861. from the cached value.  Changes to a graphic context (SETF and
  4862. with-gcontext) are always deferred regardless of the cache mode, and sent to
  4863. the server only when required by a local operation or by an explicit call to
  4864. force-gcontext-changes.
  4865.  
  4866.  
  4867. 5.2.  Graphic Context Functions
  4868.  
  4869. CLX provides a number of useful functions that return data from a graphic
  4870. context.  All other elements (that is, those for which no functions are
  4871. defined) are internal to CLX and must not be used.  The following lists the
  4872. functions and what data they return for the specified graphic context.
  4873.  
  4874.  
  4875. (DEFUN gcontext-equal (gcontext-1 gcontext-2)
  4876.   (DECLARE (TYPE gcontext gcontext-1 gcontext-2)
  4877.            (VALUES equal?)
  4878.            (TYPE boolean equal?)))
  4879.  
  4880. gcontext-1
  4881. gcontext-2
  4882.         The graphic contexts that are to be compared for equality.
  4883.  
  4884. This function returns non-null if the two graphic contexts arguments have
  4885. equivalent attribute values and NIL if they do not.
  4886.  
  4887.  
  4888. (DEFUN gcontext-id (gcontext)
  4889.   (DECLARE (TYPE gcontext gcontext)
  4890.            (VALUES id)
  4891.            (TYPE resource-id id)))
  4892.  
  4893. gcontext
  4894.         The graphic context whose resource id is to be accessed.
  4895.  
  4896. This function returns the unique id that has been assigned to the specified
  4897. graphic context by the server.
  4898.  
  4899.  
  4900. (DEFUN gcontext-p (gcontext)
  4901.   (DECLARE (TYPE T gcontext)
  4902.            (VALUES gcontext?)
  4903.            (TYPE boolean gcontext?)))
  4904.  
  4905. gcontext
  4906.         The data object which is to be tested to see if it is a graphic
  4907.         context.
  4908.  
  4909. This function returns non-null if the argument is a graphic context and NIL
  4910. otherwise.
  4911.  
  4912.  
  4913. 5.3.  Graphic Context Attributes
  4914.  
  4915. The attributes of a graphic context are the values that are used by the
  4916. graphic operations to control their execution.  This sections describes what
  4917. each of these attributes are used for and the CLX functions that can be used
  4918. to access and change them.
  4919.  
  4920. The value returned by these accessing functions will be NIL if the last
  4921. value stored is unknown (e.g., the cache was turned off, or the component
  4922. was copied from a graphic context whose state was unknown).
  4923.  
  4924.  
  4925. 5.3.1.  Arc-Mode
  4926.  
  4927. The arc-mode attribute of a graphic context controls what kind of filling
  4928. (IF any) is done by the draw-arcs function.  A value of :chord specifies
  4929. that arcs will be filled inward to the chord between the end points of the
  4930. arc.  While :pie-slice specifies that arcs will be inward to the center
  4931. point of the arc creating a pie slice effect.
  4932.  
  4933.  
  4934. (DEFUN gcontext-arc-mode (gcontext)
  4935.   (DECLARE (TYPE gcontext gcontext)
  4936.            (VALUES arc-mode)
  4937.            (TYPE (MEMBER :chord :pie-slice) arc-mode)))
  4938.  
  4939. Settable.
  4940.  
  4941. gcontext
  4942.         The graphic context whose arc-mode attribute is to be accessed.
  4943.  
  4944. This function returns the arc-mode attribute of the specified graphic
  4945. context.
  4946.  
  4947.  
  4948. 5.3.2.  Background and Foreground
  4949.  
  4950. The foreground attribute of a graphic context specifies the pixel value that
  4951. is drawn for set bits in a bitmap and for bits set by a graphic operation.
  4952. The background attribute specifies the pixel value that is drawn for bits
  4953. that are not set in a bitmap and for bits that are cleared by a graphics
  4954. operation, such as the gaps in dashed lines.
  4955.  
  4956.  
  4957. (DEFUN gcontext-background (gcontext)
  4958.   (DECLARE (TYPE gcontext gcontext)
  4959.            (VALUES background)
  4960.            (TYPE card32 background)))
  4961.  
  4962. Settable.
  4963.  
  4964. gcontext
  4965.         The graphic context whose background attribute is to be accessed.
  4966.  
  4967. This function returns the background attribute of the specified graphic
  4968. context.
  4969.  
  4970.  
  4971. (DEFUN gcontext-foreground (gcontext)
  4972.   (DECLARE (TYPE gcontext gcontext)
  4973.            (VALUES foreground)
  4974.            (TYPE card32 foreground)))
  4975.  
  4976. Settable.
  4977.  
  4978. gcontext
  4979.         The graphic context whose foreground attribute is to be accessed.
  4980.  
  4981. This function returns the foreground attribute of the specified graphic
  4982. context.
  4983.  
  4984.  
  4985. 5.3.3.  Cap-Style and Join-Style
  4986.  
  4987. The cap-style attribute of a graphic context defines how the end points of a
  4988. path are drawn.  The possible values and how they are interpreted are:
  4989.  
  4990. :butt           Square at the end point (perpendicular to the slope of the
  4991.                 line) with no projection beyond.
  4992.  
  4993. :not-last       Equivalent to :butt, except that for a line-width of zero
  4994.                 or one the final end point is not drawn.
  4995.  
  4996. :projecting     Square at the end, but the path continues beyond the
  4997.                 end point for a distance equal to half the line-width.  This
  4998.                 is equivalent to :butt for line-width zero or one.
  4999.  
  5000. :round          A circular arc with the diameter equal to the line-width,
  5001.                 centered on the end point.  This is equivalent to :butt for
  5002.                 line-width zero or one.
  5003.  
  5004. For a line with coincident end points when the cap-style is applied to both
  5005. end points, the semantics depends on the line-width and the cap-style as
  5006. follows:
  5007.  
  5008. :butt           thin    Device dependent, but the desired effect is that a
  5009.                         single pixel is drawn.
  5010.  
  5011. :butt           wide    Nothing is drawn.
  5012.  
  5013. :not-last       thin    Device dependent, but the desired effect is that
  5014.                         nothing is drawn.
  5015.  
  5016. :projecting     thin    Same as :butt/thin.
  5017.  
  5018. :projecting     wide    The closed path is a square, aligned with the
  5019.                         coordinate axes, centered at the end point, with
  5020.                         sides equal to the line-width
  5021.  
  5022. :round          wide    The closed path is a circle, centered at the end
  5023.                         point, with diameter equal to the line-width.
  5024.  
  5025. :round          thin    Same as :butt/thin.
  5026.  
  5027. The join-style attribute of a graphic context defines how the corners are
  5028. drawn for connected wide lines.  The possible values and how they are
  5029. interpreted are:
  5030.  
  5031. :bevel          Uses :butt end point styles with the triangular notch filled.
  5032.  
  5033. :miter          The outer edges of two lines extend to meet at an angle.
  5034.  
  5035. :round          A circular arc with diameter equal to the line-width,
  5036.                 centered on the join point.
  5037.  
  5038. For a line with coincident end points when the join-style is applied at one
  5039. or both end points, the effect is as if the line was removed from the
  5040. overall path.  However, if the total path consists of or is reduced to a
  5041. single point joined with itself, the effect is the same as when the
  5042. cap-style is applied at both end points.
  5043.  
  5044.  
  5045. (DEFUN gcontext-cap-style (gcontext)
  5046.   (DECLARE (TYPE gcontext gcontext)
  5047.            (VALUES cap-style)
  5048.            (TYPE (MEMBER :butt :not-last :projecting :round) cap-style)))
  5049.  
  5050. Settable.
  5051.  
  5052. gcontext
  5053.         The graphic context whose cap-style attribute is to be accessed.
  5054.  
  5055. This function returns the cap-style attribute of the specified graphic
  5056. context.
  5057.  
  5058.  
  5059. (DEFUN gcontext-join-style (gcontext)
  5060.   (DECLARE (TYPE gcontext gcontext)
  5061.            (VALUES join-style)
  5062.            (TYPE (MEMBER :bevel :miter :round) join-style)))
  5063.  
  5064. Settable.
  5065.  
  5066. gcontext
  5067.         The graphic context whose join-style attribute is to be accessed.
  5068.  
  5069. This function returns the join-style attribute of the specified graphic
  5070. context.
  5071.  
  5072.  
  5073. 5.3.4.  Clip-Mask, Clip-Ordering, Clip-X, Clip-Y, and Subwindow-Mode
  5074.  
  5075. The clip-mask attribute of a graphic context affects all graphic operations
  5076. and is used to restrict writes to the destination drawable.  The clip-mask
  5077. does not clip the sources of graphic operations.  A value of :none for
  5078. clip-mask indicates that no clipping is to be done and the pixels are always
  5079. drawn.
  5080.  
  5081. If a pixmap is specified as the clip-mask, it must have depth one and have
  5082. the same root as the graphic context that it is being specified as the
  5083. clip-mask for.  Pixels where the clip-mask has a one bit are drawn.  Pixels
  5084. outside the area covered by the clip-mask or where the clip-mask has a zero
  5085. bit are not drawn.
  5086.  
  5087. If a sequence of rectangles is specified as the clip-mask the output is
  5088. clipped to remain contained within the rectangles.  The rectangles should be
  5089. non-intersecting, or the results of the graphic operations will be
  5090. undefined.  The rectangle coordinates are interpreted relative to the clip
  5091. origin.  Note that the sequence of rectangles can be empty, which
  5092. effectively disables output.  This is the opposite of setting the clip-mask
  5093. to :none.
  5094.  
  5095. If known by the client the ordering of the rectangles specified for the
  5096. clip-mask attribute can be specified with the clip-ordering attribute.  This
  5097. may provide faster operation by the server.  A value of :unsorted means the
  5098. rectangles are in arbitrary order.  A value of :y-sorted means that the
  5099. rectangles are non-decreasing in their Y origin.  A :yx-sorted value is like
  5100. :y-sorted with the additional constraint that all rectangles with an equal Y
  5101. origin are non-decreasing in their X origin.  A :yx-banded value
  5102. additionally constrains :yx-sorted by requiring that, for every possible Y
  5103. scan line, all rectangles that include that scan line have an identical Y
  5104. origins and Y extents.  If an incorrect ordering is specified, the X server
  5105. may generate an error, but it is not required to do so.  If no error is
  5106. generated, the results of the graphic operations are undefined.
  5107.  
  5108. The clip-x and clip-y attributes specify the origin for the clip-mask
  5109. whether it is a pixmap or a sequence of rectangles.  These coordinates are
  5110. interpreted relative to the origin of whatever destination drawable is
  5111. specified in a graphic operation.
  5112.  
  5113. The subwindow-mode attribute of a graphic context specifies whether
  5114. subwindows obscure the contents of their parent window during a graphic
  5115. operation.  For a value of :clip-by-children, both source and destination
  5116. windows are clipped by all viewable input-output class children.  This
  5117. clipping is in addition to the clipping provided by the clip-mode attribute.
  5118. For a value of :include-inferiors, neither the source nor destination window
  5119. is clipped by its inferiors.  This will result in including subwindow
  5120. contents in the source and drawing through subwindow boundaries of the
  5121. destination.  The use of :include-inferiors on a window of one depth with
  5122. mapped inferiors of differing depth is not illegal, but the semantics are
  5123. not defined by the core protocol.
  5124.  
  5125.  
  5126. (DEFUN gcontext-clip-mask (gcontext)
  5127.   (DECLARE (TYPE gcontext gcontext)
  5128.            (VALUES clip-mask ordering)
  5129.            (TYPE (OR NULL (MEMBER :none) pixmap rect-seq) clip-mask)
  5130.            (TYPE (OR NULL (MEMBER :unsorted :y-sorted :yx-banded :yx-sorted))
  5131.                  ordering)))
  5132.  
  5133. Settable (see below).
  5134.  
  5135. gcontext
  5136.         The graphic context whose clip-mask and clip-ordering attributes are
  5137.         to be accessed.
  5138.  
  5139. This function returns the clip-mask attribute of the specified graphic
  5140. context and the associated clip-ordering (if the clip mask is a sequence of
  5141. rectangles) as multiple values.
  5142.  
  5143.  
  5144. (DEFUN set-gcontext-clip-mask (gcontext ordering clip-mask)
  5145.   (DECLARE (TYPE gcontext gcontext)
  5146.            (TYPE (OR NULL
  5147.                      (MEMBER :unsorted :y-sorted :yx-sorted :yx-banded))
  5148.                  ordering)
  5149.            (TYPE (OR (MEMBER :none) pixmap rect-seq) clip-mask)
  5150.            (VALUES clip-mask)
  5151.            (TYPE '(or (member :none) pixmap rect-seq) clip-mask)))
  5152.  
  5153. (DEFSETF gcontext-clip-mask (gcontext &optional ordering) (clip-mask)
  5154.   (DECLARE (TYPE gcontext gcontext)
  5155.            (TYPE (OR NULL
  5156.                      (MEMBER :unsorted :y-sorted :yx-banded :yx-sorted))
  5157.                  ordering)
  5158.            (TYPE (OR (MEMBER :none) pixmap rect-seq) clip-mask)
  5159.            (VALUES clip-mask)
  5160.        (TYPE '(or (member :none) pixmap rect-seq) clip-mask)))
  5161.  
  5162. gcontext
  5163.         Specifies the graphic context whose clip-mask and clip-ordering
  5164.         attributes are being set.
  5165.  
  5166. ordering
  5167.         If the new clip-mask is a sequence of rectangles then this specifies
  5168.         how the rectangles are ordered within the sequence.
  5169.  
  5170. clip-mask
  5171.         Specifies the new value of the clip-mask attribute for the specified
  5172.         graphic context.
  5173.  
  5174. A nil clip-mask is transformed to an empty vector
  5175.  
  5176.  
  5177. (DEFUN gcontext-clip-x (gcontext)
  5178.   (DECLARE (TYPE gcontext gcontext)
  5179.            (VALUES clip-x)
  5180.            (TYPE int16 clip-x)))
  5181.  
  5182. Settable.
  5183.  
  5184. gcontext
  5185.         The graphic context whose clip-x attribute is to be accessed.
  5186.  
  5187. This function returns the clip-x attribute of the specified graphic context.
  5188.  
  5189.  
  5190. (DEFUN gcontext-clip-y (gcontext)
  5191.   (DECLARE (TYPE gcontext gcontext)
  5192.            (VALUES clip-y)
  5193.            (TYPE int16 clip-y)))
  5194.  
  5195. Settable.
  5196.  
  5197. gcontext
  5198.         The graphic context whose clip-y attribute is to be accessed.
  5199.  
  5200. This function returns the clip-y attribute of the specified graphic context.
  5201.  
  5202.  
  5203. (DEFUN gcontext-subwindow-mode (gcontext)
  5204.   (DECLARE (TYPE gcontext gcontext)
  5205.            (VALUES subwindow-mode)
  5206.            (TYPE (MEMBER :clip-by-children :include-inferiors)
  5207.              subwindow-mode)))
  5208.  
  5209. Settable.
  5210.  
  5211. gcontext
  5212.         The graphic context whose subwindow-mode attribute is to be accessed.
  5213.  
  5214. This function returns the subwindow-mode attribute of the specified graphic
  5215. context.
  5216.  
  5217.  
  5218. 5.3.5.  Dash-Offset, Dashes, and Line-Style
  5219.  
  5220. The dash-offset attribute of a graphic context defines the phase of the
  5221. pattern contained in the dashes attribute.  This phase specifies how many
  5222. elements (pixels) into the path the pattern should actually begin in any
  5223. single graphics operation.  Dashing is continuous through path elements
  5224. combined with a join-style, but is reset to the dash-offset each time a
  5225. cap-style is applied at a line end point.
  5226.  
  5227. The dashes attribute in a graphic context specifies the pattern that is used
  5228. for graphic operations which use the dashed line styles.  It is a non-null
  5229. sequence with each element representing the length of a single dash or
  5230. space.  The initial and alternating elements (2nd, 4th, and so on) of the
  5231. dashes are the even dashes, while the others are the odd dashes.  An odd
  5232. length sequence is equivalent to the same sequence concatenated with itself
  5233. to produce an even length sequence.  All of the elements of a dashes
  5234. sequence must be non-zero.
  5235.  
  5236. Specifying a single integer value, N, for the dashes attribute is an
  5237. abbreviated way of specifying a two element sequence with both elements
  5238. equal to the specified value [N, N].
  5239.  
  5240. The unit of measure for dashes is the same as in the ordinary coordinate
  5241. system.  Ideally, a dash length is measured along the slope of the line, but
  5242. server implementations are only required to match this ideal for horizontal
  5243. and vertical lines.
  5244.  
  5245. The line-style attribute of a graphic context specifies how (which sections
  5246. of) lines are drawn for a path in graphic operations.  The possible values
  5247. and their meanings are:
  5248.  
  5249. :solid          The full path is drawn.
  5250.  
  5251. :double-dash    The full path is drawn, but the even dashes are filled
  5252.                 differently than the odd dashes with :butt style used where
  5253.                 even and odd dashes meet (see fill-style, section 5.3.7).
  5254.  
  5255. :on-off-dash    Only the even dashes are drawn, with cap-style applied to
  5256.                 all internal ends of the individual dashes, except :not-last
  5257.                 is treated as :butt.
  5258.  
  5259.  
  5260. (DEFUN gcontext-dash-offset (gcontext)
  5261.   (DECLARE (TYPE gcontext gcontext)
  5262.            (VALUES dash-offset)
  5263.            (TYPE card16 dash-offset)))
  5264.  
  5265. Settable.
  5266.  
  5267. gcontext
  5268.         The graphic context whose dash-offset attribute is to be accessed.
  5269.  
  5270. This function returns the dash-offset attribute of the specified graphic
  5271. context.
  5272.  
  5273.  
  5274. (DEFUN gcontext-dashes (gcontext)
  5275.   (DECLARE (TYPE gcontext gcontext)
  5276.            (VALUES dashes)
  5277.            (TYPE (OR card8 (SEQUENCE card8)) dashes)))
  5278.  
  5279. Settable.
  5280.  
  5281. gcontext
  5282.         The graphic context whose dashes attribute is to be accessed.
  5283.  
  5284. This function returns the dashes attribute of the specified graphic context.
  5285. The sequence must be non-empty and the elements must be non-zero.
  5286.  
  5287.  
  5288. (DEFUN gcontext-line-style (gcontext)
  5289.   (DECLARE (TYPE gcontext gcontext)
  5290.            (VALUES line-style)
  5291.            (TYPE (MEMBER :dash :double-dash :solid) line-style)))
  5292.  
  5293. Settable.
  5294.  
  5295. gcontext
  5296.         The graphic context whose line-style attribute is to be accessed.
  5297.  
  5298. This function returns the line-style attribute of the specified graphic
  5299. context.
  5300.  
  5301.  
  5302. 5.3.6.  Exposures
  5303.  
  5304. The exposures attribute in a graphic context controls graphics-expose event
  5305. generation for calls to the copy-area and copy-plane functions (AND any
  5306. similar functions defined by any extensions).  A value of :on specifies you
  5307. want graphics-expose events to be reported when calling the copy-area and
  5308. copy-plane functions with this graphic context and a value of :off indicates
  5309. that you do not want them reported.
  5310.  
  5311.  
  5312. (DEFUN gcontext-exposures (gcontext)
  5313.   (DECLARE (TYPE gcontext gcontext)
  5314.            (VALUES exposures)
  5315.            (TYPE (MEMBER :off :on) exposures)))
  5316.  
  5317. Settable.
  5318.  
  5319. gcontext
  5320.         The graphic context whose exposures attribute is to be accessed.
  5321.  
  5322. This function returns the exposures attribute of the specified graphic
  5323. context.
  5324.  
  5325.  
  5326. 5.3.7.  Fill-Rule and Fill-Style
  5327.  
  5328. The fill-rule attribute in a graphic context specifies the rule to use in
  5329. deciding what pixels are inside (drawn) of paths given for filled polygons.
  5330. It may be specified as either :even-odd or :winding.
  5331.  
  5332. The :even-odd rule defines a point as inside if any infinite ray starting at
  5333. the point crosses the path an odd number of times.  Tangencies do not count
  5334. as a crossing.
  5335.  
  5336. For :winding, a point is considered inside if any infinite ray starting at
  5337. the point crosses an unequal number of clockwise and counterclockwise
  5338. directed path segments.  A clockwise directed path segment is one which
  5339. crosses the ray from left to right as observed from the point.  A
  5340. counterclockwise segment is one which crosses the ray from right to left as
  5341. observed from the point.  The case where a directed line segment is
  5342. coincident with the ray is uninteresting because you can simply choose a
  5343. different ray that is not coincident with a segment.
  5344.  
  5345. For both :even-odd and :winding, a point is infinitely small, and the path
  5346. is an infinitely thin line.  A pixel is inside if the center point of the
  5347. pixel is inside, and the center point is not on the boundary.  If the center
  5348. point is on the boundary, the pixel is inside if and only if the polygon
  5349. interior is immediately to its right (x increasing direction).  Pixels with
  5350. centers along a horizontal edge are a special case and are inside if and
  5351. only if the polygon interior is immediately below (y increasing direction).
  5352.  
  5353. The fill-style attribute of a graphic context defines the contents of the
  5354. source for line, text, and fill graphic operations.  It determines whether
  5355. the source image is drawn with a solid color, a tile, or a stippled tile.
  5356. The possible values and their meanings are:
  5357.  
  5358. :opaque-stippled        Filled with a tile with the same width and height as
  5359.                         stipple, but with the background value used
  5360.                         everywhere stipple has a zero and the foreground
  5361.                         pixel value used everywhere stipple has a one.
  5362.  
  5363. :solid                  Filled with the foreground pixel value.
  5364.  
  5365. :stippled               Filled with the foreground pixel value masked by
  5366.                         stipple.
  5367.  
  5368. :tiled                  Filled with tile.
  5369.  
  5370. When drawing lines with line-style :double-dash, the filling of the odd
  5371. dashes are controlled by the fill-style in the following manner:
  5372.  
  5373. :opaque-stippled        Same as for even dashes.
  5374.  
  5375. :solid                  Filled with the background pixel value.
  5376.  
  5377. :stippled               Filled with the background pixel value masked by
  5378.                         stipple.
  5379.  
  5380. :tiled                  Filled the same as the even dashes.
  5381.  
  5382.  
  5383. (DEFUN gcontext-fill-rule (gcontext)
  5384.   (DECLARE (TYPE gcontext gcontext)
  5385.            (VALUES fill-rule)
  5386.            (TYPE (MEMBER :even-odd :winding) fill-rule)))
  5387.  
  5388. Settable.
  5389.  
  5390. gcontext
  5391.         The graphic context whose fill-rule attribute is to be accessed.
  5392.  
  5393. This function returns the fill-rule attribute of the specified graphic
  5394. context.
  5395.  
  5396.  
  5397. (DEFUN gcontext-fill-style (gcontext)
  5398.   (DECLARE (TYPE gcontext gcontext)
  5399.            (VALUES fill-style)
  5400.            (TYPE (MEMBER :opaque-stippled :solid :stippled :tiled)
  5401.                  fill-style)))
  5402.  
  5403. Settable.
  5404.  
  5405. gcontext
  5406.         The graphic context whose fill-style attribute is to be accessed.
  5407.  
  5408. This function returns the fill-style attribute of the specified graphic
  5409. context.
  5410.  
  5411.  
  5412. 5.3.8.  Font
  5413.  
  5414. The font attribute in a graphic context defines the default text font that
  5415. is used in text drawing operations.
  5416.  
  5417.  
  5418. (DEFUN gcontext-font (gcontext &optional metrics-p)
  5419.   (DECLARE (TYPE gcontext gcontext)
  5420.            (TYPE boolean metrics-p)
  5421.            (VALUES font)
  5422.            (TYPE (OR NULL font) font)))
  5423.  
  5424. (DEFSETF gcontext-font (gcontext) (font)
  5425.   (DECLARE (TYPE gcontext gcontext)
  5426.            (TYPE fontable font)
  5427.            (VALUES font)
  5428.        (TYPE (OR NULL font) font)))
  5429.  
  5430. Settable.
  5431.  
  5432. gcontext
  5433.         The graphic context whose font attribute is to be accessed.
  5434.  
  5435. metrics-p
  5436.         Specifies whether or not a pseudo font is returned when the real
  5437.         font stored in the graphic context is not known.  The default is NIL
  5438.         which means don't return a pseudo font.
  5439.  
  5440. This function returns the font attribute of the specified graphic context.
  5441. If the stored font is known, it is returned.  If it is not known and the
  5442. metrics-p argument is NIL, then NIL is returned.  If the font is not known
  5443. and metrics-p is true, then a pseudo font is constructed and returned.  For
  5444. a constructed pseudo font, full metric and property information can be
  5445. obtained, but it does not have a name or a resource-id, and attempts to use
  5446. it where a resource-id is required will result in an invalid-font error.
  5447.  
  5448. When setting the value of the font attribute either a font object or a font
  5449. name can be used.  If a font name is passed an automatic call to open-font
  5450. is made get the font object.
  5451.  
  5452.  
  5453. 5.3.9.  Function and Plane-Mask
  5454.  
  5455. You use the graphic context function attribute when you update a section of
  5456. the screen (destination) with bits from somewhere else (source).  The
  5457. function defines how the new destination bits are to be computed from the
  5458. source bits and the old destination bits.  There are 16 such functions
  5459. defined in CLX which match the boolean operation-code constants defined in
  5460. the Common LISP language.  The functions and their corresponding constants
  5461. are:
  5462.  
  5463.   ------------------------------------------------------------------------
  5464.   Constant      Example                         Operation
  5465.   Name          (src=0011, dst=0101)            Performed
  5466.   ------------------------------------------------------------------------
  5467.   BOOLE-CLR     0000    0                       set to zero
  5468.   BOOLE-SET     1111    1                       set to one
  5469.   BOOLE-1       0011    src                     copy source
  5470.   BOOLE-2       0101    dst                     no-operation
  5471.   BOOLE-C1      1100    (NOT src)               complement source
  5472.   BOOLE-C2      1010    (NOT dst)               complement destination
  5473.   BOOLE-AND     0001    (src AND dst)           and
  5474.   BOOLE-IOR     0111    (src OR dst)            inclusive or
  5475.   BOOLE-XOR     0110    (src XOR dst)           exclusive or
  5476.   BOOLE-EQV     1001    ((NOT src) XOR dst)     equivalence (exclusive nor)
  5477.   BOOLE-NAND    1110    (NOT (src AND dst))     not-and
  5478.   BOOLE-NOR     1000    (NOT (src OR dst))      not-or
  5479.   BOOLE-ANDC1   0100    ((NOT src) AND dst)     and complement of source
  5480.                                                 with destination
  5481.   BOOLE-ANDC2   0010    (src AND (NOT dst))     and source with complement
  5482.                                                 of destination
  5483.   BOOLE-ORC1    1101    ((NOT src) OR dst)      or complement of source
  5484.                                                 with destination
  5485.   BOOLE-ORC2    1011    (src OR (NOT dst))      or source with complement
  5486.                                                 of destination
  5487.   ------------------------------------------------------------------------
  5488.  
  5489. The plane-mask attribute in a graphic context specifies which planes of the
  5490. display are to be modified during graphic operations.  There is one bit in
  5491. the mask per memory plane in the display.  A monochrome display has only one
  5492. plane which will be assigned the least significant bit of the plane-mask.
  5493. As planes are added to the display hardware, they will occupy more
  5494. significant bits in the plane mask.
  5495.  
  5496. In graphic operations, given a source and destination pixel, the result is
  5497. computed bitwise on corresponding bits of the pixels.  That is, a boolean
  5498. operation is performed in each bit plane.  The plane-mask restricts the
  5499. operation to a subset of the planes.  That is, the result is computed
  5500. according to the following formula:
  5501.  
  5502.         ((src FUNCTION dst) AND plane-mask) OR (dst AND (NOT plane-mask))
  5503.  
  5504.  
  5505. (DEFUN gcontext-function (gcontext)
  5506.   (DECLARE (TYPE gcontext gcontext)
  5507.            (VALUES function)
  5508.            (TYPE boole-constant function)))
  5509.  
  5510. Settable.
  5511.  
  5512. gcontext
  5513.         The graphic context whose function attribute is to be accessed.
  5514.  
  5515.  
  5516. (DEFUN gcontext-plane-mask (gcontext)
  5517.   (DECLARE (TYPE gcontext gcontext)
  5518.            (VALUES plane-mask)
  5519.            (TYPE card32 plane-mask)))
  5520.  
  5521. Settable.
  5522.  
  5523. gcontext
  5524.         The graphic context whose plane-mask attribute is to be accessed.
  5525.  
  5526.  
  5527. 5.3.10.  Line-Width
  5528.  
  5529. The line-width is measured in pixels and can be greater than or equal to one
  5530. (wide line) or can be the special value zero (thin line).
  5531.  
  5532. Wide lines are drawn centered on the path described by the graphic
  5533. operation.  Unless otherwise specified by the join or cap style, the
  5534. bounding box of a wide line with end points [x1, y1], [x2, y2], and width w
  5535. is a rectangle with vertices at the following real coordinates:
  5536.  
  5537.         [x1-(w*sn/2), y1+(w*cs/2)], [x1+(w*sn/2), y1-(w*cs/2)],
  5538.         [x2-(w*sn/2), y2+(w*cs/2)], [x2+(w*sn/2), y2-(w*cs/2)]
  5539.  
  5540. Where sn is the sine of the angle of the line and cs is the cosine of the
  5541. angle of the line.  A pixel is part of the line and, hence, is drawn, if the
  5542. center of the pixel is fully inside the bounding box (which is viewed as
  5543. having infinitely thin edges).  If the center of the pixel is exactly on the
  5544. bounding box, it is part of the line if and only if the interior is
  5545. immediately to its right (x increasing direction).  Pixels with centers on a
  5546. horizontal edge are a special case and are part of the line if and only if
  5547. the interior is immediately below (y increasing direction).
  5548.  
  5549. Thin lines (zero line-width) are always one pixel wide lines drawn using an
  5550. unspecified, device dependent algorithm.  There are only two constraints on
  5551. this algorithm.
  5552.  
  5553. 1.   If a line is drawn unclipped from [x1,y1] to [x2,y2] and if another
  5554.      line is drawn unclipped from [x1+dx,y1+dy] to [x2+dx,y2+dy], a point
  5555.      [x,y] is touched by drawing the first line if and only if the point
  5556.      [x+dx,y+dy] is touched by drawing the second line.
  5557.  
  5558. 2.   The effective set of points comprising a line cannot be affected by
  5559.      clipping.  That is, a point is touched in a clipped line if and only if
  5560.      the point lies inside the clipping region and the point would be
  5561.      touched by the line when drawn unclipped.
  5562.  
  5563. A wide line drawn from [x1,y1] to [x2,y2] always draws the same pixels as a
  5564. wide line drawn from [x2,y2] to [x1,y1], not counting cap and join styles.
  5565. Implementors are encouraged to make this property true for thin lines, but
  5566. it is not required.  A line-width of zero may differ from a line-width of
  5567. one in which pixels are drawn.  This permits the use of many manufacturer's
  5568. line drawing hardware, which may run much faster than the more precisely
  5569. specified wide lines.
  5570.  
  5571. In general, drawing a thin line will be faster than drawing a wide line of
  5572. width one.  However, because of their different drawing algorithms, thin
  5573. lines may not mix well, aesthetically speaking, with wide lines.  If it is
  5574. desirable to obtain precise and uniform results across all displays, a
  5575. client should always use a line-width of one, rather than a line-width of
  5576. zero.
  5577.  
  5578.  
  5579. (DEFUN gcontext-line-width (gcontext)
  5580.   (DECLARE (TYPE gcontext gcontext)
  5581.            (VALUES line-width)
  5582.            (TYPE card16 line-width)))
  5583.  
  5584. Settable.
  5585.  
  5586. gcontext
  5587.         The graphic context whose line-width attribute is to be accessed.
  5588.  
  5589.  
  5590. 5.3.11.  Stipple, Tile, TS-X, and TS-Y
  5591.  
  5592. The stipple attribute of a graphic context contains a bitmap that is used to
  5593. prevent certain pixels in the destination of graphic operations from being
  5594. affected by tiling.  The tile attribute is a pixmap that is used to fill in
  5595. areas for graphic operations.  They are so named because copies of them are
  5596. laid out side by side to fill in the area.  The ts-x and ts-y attributes of
  5597. a graphic context are the coordinates of the origin for the stipple and tile
  5598. pixmaps.
  5599.  
  5600. The stipple and tile have the same origin.  This origin point is interpreted
  5601. relative to the origin of whatever destination drawable is specified in a
  5602. graphics request.  The stipple pixmap must have depth one and must have the
  5603. same root as the graphic context.  The tile pixmap must have the same root
  5604. and depth as the graphic context.  For stipple operations where the
  5605. fill-style is :stippled (but not :opaque-stippled) the stipple pattern is
  5606. tiled in a single plane and acts as an additional clip mask to be ANDed with
  5607. the clip-mask.  Any size pixmap can be used for stipple or tile, although
  5608. some sizes may be faster to use than others.
  5609.  
  5610. Specifying a pixmap for stipple or tile in a graphic context might or might
  5611. not result in a copy being made.  If the pixmap is later used as the
  5612. destination for a graphic operation, the change might or might not be
  5613. reflected in the graphic context.  If the pixmap is used both as the
  5614. destination for a graphic operation and as a stipple or tile, the results
  5615. are not defined.
  5616.  
  5617. Some displays have hardware support for tiling or stippling with patterns of
  5618. specific sizes.  Tiling and stippling operations that that restrict
  5619. themselves to those sizes may run much faster than such operations with
  5620. arbitrary size patterns.  CLX provides functions with which you can
  5621. determine the best size for stipple or tile.
  5622.  
  5623.  
  5624. (DEFUN gcontext-stipple (gcontext)
  5625.   (DECLARE (TYPE gcontext gcontext)
  5626.            (VALUES stipple)
  5627.            (TYPE pixmap stipple)))
  5628.  
  5629. Settable.
  5630.  
  5631. gcontext
  5632.         The graphic context whose stipple attribute is to be accessed.
  5633.  
  5634.  
  5635. (DEFUN gcontext-tile (gcontext)
  5636.   (DECLARE (TYPE gcontext gcontext)
  5637.            (VALUES tile)
  5638.            (TYPE pixmap tile)))
  5639.  
  5640. Settable.
  5641.  
  5642. gcontext
  5643.         The graphic context whose tile attribute is to be accessed.
  5644.  
  5645.  
  5646. (DEFUN gcontext-ts-x (gcontext)
  5647.   (DECLARE (TYPE gcontext gcontext)
  5648.            (VALUES ts-x)
  5649.            (TYPE int16 ts-x)))
  5650.  
  5651. Settable.
  5652.  
  5653. gcontext
  5654.         The graphic context whose ts-x attribute is to be accessed.
  5655.  
  5656.  
  5657. (DEFUN gcontext-ts-y (gcontext)
  5658.   (DECLARE (TYPE gcontext gcontext)
  5659.            (VALUES ts-y)
  5660.            (TYPE int16 ts-y)))
  5661.  
  5662. Settable.
  5663.  
  5664. gcontext
  5665.         The graphic context whose ts-y attribute is to be accessed.
  5666.  
  5667.  
  5668. (DEFUN query-best-stipple (width height drawable)
  5669.   (DECLARE (TYPE card16 width height)
  5670.            (TYPE drawable drawable)
  5671.            (VALUES best-width best-height)
  5672.            (TYPE card16 best-width best-height)))
  5673.  
  5674. (DEFUN query-best-tile (width height drawable)
  5675.   (DECLARE (TYPE card16 width height)
  5676.            (TYPE drawable drawable)
  5677.            (VALUES width height)
  5678.            (TYPE card16 best-width best-height)))
  5679.  
  5680. width
  5681. height  Specifies the width and height of the desired stipple or tile
  5682.         pattern.
  5683.  
  5684. drawable
  5685.         Specifies the drawable which you are interested in setting the
  5686.         stipple or tile for.
  5687.  
  5688. These functions return the best ("best" means the size that can be drawn
  5689. fastest) size or the stipple or tile for the screen that contains the
  5690. specified drawable.  The drawable indicates the screen and possibly the
  5691. window class and depth.  An input-only window cannot be specified as the
  5692. drawable for these functions.  The size is returned as width and height in
  5693. multiple values.
  5694.  
  5695.  
  5696. 5.4.  Copying Graphic Contexts
  5697.  
  5698. CLX provides functions with which you can copy some or all attribute values
  5699. from one graphic context to another.  You might wonder why this isn't just
  5700. done using SETF.  The answer is that these functions request that the server
  5701. do the copy internally without sending the data back through the client
  5702. application.  This will generally be more efficient (particularly for things
  5703. like clip and dash lists).
  5704.  
  5705.  
  5706. (DEFUN copy-gcontext (src dst)
  5707.   (DECLARE (TYPE gcontext src dst)))
  5708.  
  5709. src     Specifies the graphic context from which the attribute values are
  5710.         to be copied.
  5711.  
  5712. dst     Specifies the graphic context to which the attributes values are to
  5713.         be copied.
  5714.  
  5715. This function copies all of the values of the attributes of the source
  5716. graphic context into the destination graphic context.  The source and
  5717. destination graphic contexts must have the same root and depth.
  5718.  
  5719.  
  5720. (DEFUN copy-gcontext-components (src dst &rest keys)
  5721.   (DECLARE (TYPE gcontext src dst)
  5722.            (TYPE LIST keys)))
  5723.  
  5724. src     Specifies the graphic context from which the attribute values are
  5725.         to be copied.
  5726.  
  5727. dst     Specifies the graphic context to which the attributes values are to
  5728.         be copied.
  5729.  
  5730. keys    The remaining arguments are keywords, of type gcontext-key, which
  5731.         specify which attributes of the graphic context are to be copied.
  5732.  
  5733.  
  5734. This function copies the values of the specified attributes of the source
  5735. graphic context to the destination graphic context.  The source and
  5736. destination graphic contexts must have the same root and depth.
  5737.  
  5738.  
  5739. 5.5.  Destroying Graphic Contexts
  5740.  
  5741.  
  5742. (DEFUN free-gcontext (gcontext)
  5743.   (DECLARE (TYPE gcontext gcontext)))
  5744.  
  5745. gcontext
  5746.         The graphic context which is to be freed.
  5747.  
  5748. This function deletes the association between the assigned resource id and
  5749. the specified graphic context and then destroys the graphic context.  This
  5750. function destroys the specified graphic context as well as the shadow copy.
  5751.  
  5752.  
  5753. 5.6.  Graphic Context Cache
  5754.  
  5755. CLX provides a set of functions that allow a programmer to exercise some
  5756. control the automatic graphic context caching mechanism.  This section
  5757. explains the use of the functions that interface to this feature.
  5758.  
  5759.  
  5760. (DEFUN force-gcontext-changes (gcontext)
  5761.   (DECLARE (TYPE gcontext gcontext)))
  5762.  
  5763. gcontext
  5764.         Specifies the graphic context whose delayed changes are to be sent.
  5765.  
  5766. This function forces any delayed changes to the specified graphic context to
  5767. be sent out to the server.
  5768.  
  5769.  
  5770. (DEFMACRO with-gcontext ((gcontext
  5771.                           &key arc-mode background cap-style clip-mask
  5772.                                clip-ordering clip-x clip-y dashes
  5773.                                dash-offset exposures fill-rule fill-style
  5774.                                font foreground function join-style
  5775.                                line-style line-width plane-mask stipple
  5776.                                subwindow-mode tile ts-x ts-y
  5777.               &allow-other-keys)
  5778.              &body body))
  5779.  
  5780. gcontext
  5781.         Specifies the graphic context whose components are to be temporarily
  5782.         altered.
  5783.  
  5784. :arc-mode
  5785. :background
  5786. :cap-style
  5787. :clip-mask
  5788. :clip-ordering
  5789. :clip-x
  5790. :clip-y
  5791. :dashes
  5792. :dash-offset
  5793. :exposures
  5794. :fill-rule
  5795. :fill-style
  5796. :font
  5797. :foreground
  5798. :function
  5799. :join-style
  5800. :line-style
  5801. :line-width
  5802. :plane-mask
  5803. :stipple
  5804. :subwindow-mode
  5805. :tile
  5806. :ts-x
  5807. :ts-y    These keyword arguments and associated values specify which graphic
  5808.         context components are be changed and their new values.  Any
  5809.         components not specified are left unmodified. See section
  5810.     5.1 creating graphics contexts for more information.
  5811.  
  5812. body    The body of code which will have access to the altered graphic
  5813.         context.
  5814.  
  5815. This macro changes the indicated graphic context components to the specified
  5816. values within the dynamic scope of the body (indefinite scope and dynamic
  5817. extent).  This will work on a per-process basis in a multiprocessing
  5818. environment.  The body is not surrounded by a with-display form.  If there
  5819. is no local cache for the specified graphic context or if some of the
  5820. component states are unknown, this function will do the save and restore by
  5821. creating a temporary graphic context and copying components to and from it
  5822. using copy-gcontext-components.
  5823.  
  5824.  
  5825.  
  5826.  
  5827.  
  5828.                   Chapter 6
  5829.  
  5830.              Graphics Resource Functions
  5831.  
  5832.  
  5833.  
  5834. 6.1.  Colormaps and Colors
  5835.  
  5836. A colormap is a collection of color cells.  A color cell contains of a
  5837. triple of red, green, and blue values.  A pixel is an index into a colormap.
  5838. As each pixel is read out of display memory, its value is taken and used to
  5839. looked up a color cell in the colormap.  The values in the cell determine
  5840. what color is displayed on the screen.  On a multiplane display with a black
  5841. and white monitor (grayscale, but not color), these values may or may not be
  5842. combined to determine the brightness on the screen.
  5843.  
  5844. The introduction of color changes the view a programmer should take when
  5845. dealing with a bitmap display.  For example, when drawing, you write pixel
  5846. values, which are defined to be specific colors, rather than setting or
  5847. clearing bits.  The display hardware will impose limits which must be
  5848. comprehended, such as the number of significant bits in pixel values and the
  5849. number of simultaneously available colormaps.  Typically, an application
  5850. allocates color cells or sets of color cells in a colormap.  If the color
  5851. cells are read only, the pixel values for them may be shared among multiple
  5852. applications, since the RGB values for the cell cannot be changed.  If the
  5853. color cells are read/write, they are exclusively owned by the program, and
  5854. the contents may be changed at will.
  5855.  
  5856. Windows in CLX always have an associated colormap which provides a level of
  5857. indirection between pixel values and the color displayed on the screen.
  5858. Because colormaps are associated with windows, X will support displays with
  5859. multiple colormaps and, indeed, different types of colormaps.  However, many
  5860. of the hardware displays used today have a single colormap, so CLX functions
  5861. are written to encourage sharing of colormap entries between applications.
  5862. If there are not sufficient colormap resources in the display, some windows
  5863. may not be displayed in their true colors.  A window manager can set which
  5864. windows are displayed in their true colors if more than one colormap is
  5865. required for the color resources the applications are using.
  5866.  
  5867.  
  5868. 6.1.1.  Color Functions
  5869.  
  5870.  
  5871. A color is a structure containing a triple of red, green, and blue values
  5872. that define a specific visible color.  It is a representation of a set of
  5873. values that could be stored in a color cell.  Although the following RGB
  5874. oriented functions are provided for colors the intention is that other (IHS,
  5875. YIQ, and CYM) interfaces could also exist.  Note that CLX explicitly uses a
  5876. different spectrum representation than what is actually transmitted in the
  5877. protocol.
  5878.  
  5879.  
  5880. (DEFUN make-color (&key (blue 1.0) (green 1.0) (red 1.0) &allow-other-keys)
  5881.   (DECLARE (TYPE rgb-val blue green red)
  5882.        (VALUES color?)
  5883.        (TYPE color color?)))
  5884.  
  5885. :blue
  5886. :green
  5887. :red    Keyword values that specify the saturation for each primary that
  5888.         will be used to define the newly created color.  They each default
  5889.         to a value of 1.0 indicating full saturation.
  5890.  
  5891. This function creates, initializes and returns a new color structure with
  5892. the specified values for the red, green, and blue levels.
  5893.  
  5894.  
  5895. (DEFUN color-p (color)
  5896.   (DECLARE (TYPE T color)
  5897.            (VALUES color?)
  5898.            (TYPE boolean color?)))
  5899.  
  5900. color    The data object which is to be tested to see if it is a color.
  5901.  
  5902. This function returns non-null if the argument is a color and NIL otherwise.
  5903.  
  5904.  
  5905. (DEFUN color-blue (color)
  5906.   (DECLARE (TYPE color color)
  5907.            (VALUES blue-saturation)
  5908.        (TYPE rgb-val blue-saturation)))
  5909.  
  5910. Settable.
  5911.  
  5912. color    Specifies the color whose blue component is to be returned.
  5913.  
  5914. The color-blue function returns the value for the blue level in the
  5915. specified color structure.
  5916.  
  5917.  
  5918. (DEFUN color-green (color)
  5919.   (DECLARE (TYPE color color)
  5920.            (VALUES green-saturation)
  5921.        (TYPE rgb-val green-saturation)))
  5922.  
  5923. Settable.
  5924.  
  5925. color    Specifies the color whose green component is to be returned.
  5926.  
  5927. The color-green function returns the value for the green level in the
  5928. specified color structure.
  5929.  
  5930.  
  5931. (DEFUN color-red (color)
  5932.   (DECLARE (TYPE color color)
  5933.        (VALUES red-saturation)
  5934.        (TYPE rgb-val red-saturation)))
  5935.  
  5936. Settable.
  5937.  
  5938. color    Specifies the color whose green component is to be returned.
  5939.  
  5940. The color-red function returns the value for the red level in the specified
  5941. color structure.
  5942.  
  5943.  
  5944. (DEFUN color-rgb (color)
  5945.   (DECLARE (TYPE color color)
  5946.        (VALUES red green blue)
  5947.        (TYPE rgb-val red green blue)))
  5948.  
  5949. color    Specifies the color whose red, green, and blue components are to be
  5950.         returned.
  5951.  
  5952. This function returns as multiple values the values for the red, green, and
  5953. blue levels in the specified color structure.
  5954.  
  5955.  
  5956. 6.1.2.  Color Cell Functions
  5957.  
  5958.  
  5959. A color cell is an entry in a colormap that is indexed by a pixel value and
  5960. contains a red, green, blue triple defining a particular color.  Allocating
  5961. color cells is the way that a client ensures that the colors that it needs
  5962. are in the colormap.  It is also how a client determines the pixel value for
  5963. a particular color.  Color cells may be allocated as read-only, which allows
  5964. them to be shared among clients, or read/write, which gives exclusive use to
  5965. the allocating client.
  5966.  
  5967. CLX provides functions to retrieve the contents of color cells, to allocate
  5968. color cells, and to deallocate color cells.  On a screen that either cannot
  5969. load the colormap or cannot have a fully independent colormap, only certain
  5970. kinds of allocations may work.
  5971.  
  5972.  
  5973. (DEFUN alloc-color (colormap color)
  5974.   (DECLARE (TYPE colormap colormap)
  5975.        (TYPE (OR stringable color) color)
  5976.        (VALUES pixel screen-color exact-color)
  5977.        (TYPE card32 pixel)
  5978.        (TYPE color screen-color exact-color)))
  5979.  
  5980. colormap
  5981.         Specifies the colormap in which the color cell is to be allocated.
  5982.  
  5983. color    May either be a color structure or the name of a color specifying
  5984.     the color which is to be allocated in the specified colormap.
  5985.  
  5986. If the color argument is a color structure then this function allocates a
  5987. read-only colormap entry corresponding to the closest RGB values provided by
  5988. the hardware.  If the color argument is a color name then it is looked up
  5989. with respect to the screen of the specified colormap and the color object
  5990. associated with that name is used to allocated a read-only colormap entry as
  5991. described above.  The name should use the ISO Latin-1 encoding, and
  5992. uppercase and lowercase do not matter.
  5993.  
  5994. The values returned by this function are the pixel value for the color cell
  5995. which was allocated, the screen-color which is the actual contents of the
  5996. allocated color cell, and the exact-color which is the actual definition for
  5997. the specified color.  If the color argument is a color structure then it is
  5998. always returned for the exact-color return value.
  5999.  
  6000.  
  6001. (DEFUN lookup-color (colormap name)
  6002.   (DECLARE (TYPE colormap colormap)
  6003.        (TYPE stringable name)
  6004.        (VALUES screen-color exact-color)
  6005.        (TYPE color screen-color exact-color)))
  6006.  
  6007. colormap
  6008.         Specifies the colormap from which the color definition is to be
  6009.         retrieved.
  6010.  
  6011. name    Specifies the name of a color whose definition is to be returned
  6012.  
  6013. This function looks up the specified color with respect to the screen of the
  6014. specified colormap.  It returns both the screen-color which is the closest
  6015. color that can be provided by the hardware for the visual type of the
  6016. specified colormap, and the exact-color which is the actual definition for
  6017. the named color.  The name should use ISO Latin-1 encoding, and uppercase
  6018. and lowercase do not matter.
  6019.  
  6020.  
  6021. (DEFUN query-colors (colormap pixels &key (result-type 'LIST))
  6022.   (DECLARE (TYPE colormap colormap)
  6023.        (TYPE SEQUENCE pixels)
  6024.        (TYPE T :result-type)
  6025.        (VALUES colors)
  6026.        (TYPE (SEQUENCE color) colors)))
  6027.  
  6028. colormap
  6029.         Specifies the colormap whose color cells are to be queried.
  6030.  
  6031. pixels    A sequence of pixels values that specifies the individual color
  6032.         cells whose values are to be retrieved.
  6033.  
  6034. :result-type
  6035.         A keyword argument, that is a valid type specifier for a sub-type of
  6036.         SEQUENCE, indicating what kind of sequence should be created to
  6037.         return the contents of the specified color cells.  The default is to
  6038.         return them in a list.
  6039.  
  6040. This function returns a sequence of color structures which hold the contents
  6041. of the requested color cells from the specified colormap.  The values
  6042. returned for unallocated color cells are undefined.
  6043.  
  6044.  
  6045. 6.1.3.  Colormap Functions
  6046.  
  6047.  
  6048. Colormaps are local to a particular screen and a screen always has a default
  6049. colormap.  The default colormap is typically set up by the by the server
  6050. when the connection is made.  Client programs are free to allocate and free
  6051. cells out of this colormap but writing applications which monopolize color
  6052. resources is highly discouraged.
  6053.  
  6054. Although a colormap consists of a set of color cells, the values of these
  6055. color cells which may or may not be defined values.  The colormap associated
  6056. with a window is used to display the contents of the window.  Applications
  6057. should not directly modify any part of the colormap structure, except where
  6058. the elements are stated to be settable.  The other elements should be
  6059. considered read-only, although they may change as the result of other
  6060. operations on the colormap.
  6061.  
  6062.  
  6063. (DEFUN colormap-equal (colormap-1 colormap-2)
  6064.   (DECLARE (TYPE colormap colormap-1 colormap-2)))
  6065.  
  6066. colormap-1
  6067. colormap-2
  6068.     The colormap structures that are to be compared for equality.
  6069.  
  6070. This function returns non-null if the two arguments are equivalent colormap
  6071. structures and NIL if they are not.
  6072.  
  6073.  
  6074. (DEFUN colormap-id (colormap)
  6075.   (DECLARE (TYPE colormap colormap)
  6076.        (VALUES id)
  6077.        (TYPE resource-id id)))
  6078.  
  6079. colormap
  6080.         Specifies the colormap whose resource id is to be accessed.
  6081.  
  6082. This function returns the unique id that has been assigned to the specified
  6083. colormap by the server.
  6084.  
  6085.  
  6086. (DEFUN colormap-p (colormap)
  6087.   (DECLARE (TYPE colormap colormap)
  6088.        (VALUES map-p)
  6089.        (TYPE boolean map-p)))
  6090.  
  6091. colormap
  6092.         The data object which is to be tested to see if it is a colormap.
  6093.  
  6094. This function returns non-null if the argument is a colormap and NIL
  6095. otherwise.
  6096.  
  6097.  
  6098. 6.1.3.1  Creating Colormaps
  6099.  
  6100.  
  6101. CLX provides a function for creating new colormap structures.  These CLX
  6102. structures should not be confused with the physical colormaps in the display
  6103. hardware.
  6104.  
  6105.  
  6106. (DEFUN create-colormap (visual window &optional alloc-p)
  6107.   (DECLARE (TYPE card29 visual)
  6108.        (TYPE window window)
  6109.        (TYPE boolean alloc-p)
  6110.        (VALUES colormap)
  6111.        (TYPE colormap colormap)))
  6112.  
  6113. visual    Specifies the id for a visual type supported for the screen on which
  6114.         the specified window is defined.  It is an error to specify a visual
  6115.         type which is not one supported by the screen.
  6116.  
  6117. window    Specifies the window whose display the colormap is be associated
  6118.         with.
  6119.  
  6120. alloc-p    An optional parameter that specifies whether or not the color cells
  6121.         in the newly created colormap are to be pre-allocated.  The default
  6122.         is NIL which indicates that the colormap will initially have no
  6123.         allocated color cells.
  6124.  
  6125. This function creates a colormap of the specified visual type for the
  6126. display on which the window resides.  It is an error if the visual type is
  6127. not one supported by the display.  The initial values of the color cells in
  6128. the colormap are undefined for visual types of class :gray-scale,
  6129. :pseudo-color, or :direct-color.  For visual types of class :static-gray,
  6130. :static-color, or :true-color the color cells will have defined initial
  6131. values that are specific to the visual type, but these values are not
  6132. defined by the X protocol.
  6133.  
  6134. When creating a colormap for a visual type of class :static-gray,
  6135. :static-color, or :true-color the alloc-p argument must be specified as NIL.
  6136. It is an error otherwise.
  6137.  
  6138. If alloc-p is specified as NIL and the visual type is of class :gray-scale,
  6139. :pseudo-color, or :direct-color then the colormap initially has no allocated
  6140. color cells and clients are free to allocate them.  If alloc-p is specified
  6141. as T then the entire colormap is "allocated" as writable and the initial
  6142. values of all color cells are undefined.  For :gray-scale and :pseudo-color,
  6143. the effect is as if an alloc-color request returned all pixel values from
  6144. zero to N-1, where N is the colormap-entries value from the specified visual
  6145. type.  For :direct-color, the effect is as if an alloc-color-planes request
  6146. returned a pixel value of zero and red-mask, green-mask, and blue-mask
  6147. values containing the same bits as the corresponding masks in the specified
  6148. visual type.  However, in all cases, none of these entries can be freed with
  6149. free-colors.
  6150.  
  6151.  
  6152. (DEFUN copy-colormap-and-free (colormap)
  6153.   (DECLARE (TYPE colormap colormap)
  6154.        (VALUES new-colormap)
  6155.        (TYPE colormap new-colormap)))
  6156.  
  6157. colormap
  6158.         Specifies the source colormap that is to be duplicated and freed.
  6159.  
  6160. This function creates and returns a new colormap of the same visual type and
  6161. for the same screen as the specified source colormap.  It then moves all of
  6162. the calling client's allocations from the source colormap to the new
  6163. colormap, keeping their values and read-only or writable characteristics
  6164. intact, and frees those allocations.  The other allocatable color cells or
  6165. planes in the new colormap are left undefined.
  6166.  
  6167. If the specified source colormap was created by the calling client with its
  6168. color cells all pre-allocated then the new colormap is also created with
  6169. pre-allocated color cells.  In this case, the values for all color cells are
  6170. copied from the source colormap, and then all color cells in the source
  6171. colormap are freed.  If the specified source colormap was not created by the
  6172. calling client with pre-allocated color cells, then the only allocations
  6173. which are copied are those color cells and planes that have been allocated
  6174. by the client using the alloc-color, alloc-named-color, alloc-color-cells,
  6175. or alloc-color-planes functions (see section 6.??), and which have not since
  6176. been freed.
  6177.  
  6178.  
  6179. 6.1.3.2.  Installing Colormaps
  6180.  
  6181.  
  6182. A colormap is installed if the X server has loaded it into the display
  6183. hardware such that it can be used during display refresh to determine colors
  6184. on a screen.  Depending on hardware limitations, one or more colormaps may
  6185. be installed at one time, such that windows associated with those maps
  6186. display with the correct colors.
  6187.  
  6188. At any time, there is a subset of the installed colormaps called the
  6189. "required list".  The length of the required list is at most M, where M is
  6190. the minimum number of installed colormaps specified for the screen in the
  6191. connection setup.  The required list is maintained as follows.  When a
  6192. colormap is explicitly installed it is added to the head of the list, and
  6193. the list is truncated at the tail, if necessary, to keep the length of the
  6194. list to at most M.  When a colormap is explicitly uninstalled and it is in
  6195. the required list, it is removed from the list.  A colormap is not added to
  6196. the required list when it is installed implicitly by the server, and the
  6197. server cannot implicitly uninstall a colormap that is in the required list.
  6198. Initially the default colormap for a screen is installed (but is not in the
  6199. required list).
  6200.  
  6201.  
  6202. (DEFUN install-colormap (colormap)
  6203.   (DECLARE (TYPE colormap colormap)))
  6204.  
  6205. colormap
  6206.         The colormap that is to be installed.
  6207.  
  6208. This function makes the specified colormap an installed colormap and adds it
  6209. to the required list for its screen.  All windows associated with this
  6210. colormap immediately display with true colors.  As a side-effect, additional
  6211. colormaps might be implicitly installed or uninstalled by the server.  Which
  6212. other colormaps get installed or uninstalled is server-dependent, except
  6213. that the colormaps on the required list must remain installed.
  6214.  
  6215. If the specified colormap is not already installed, a colormap-notify event
  6216. is generated on every window which has this colormap associated with it.  In
  6217. addition, for every other colormap that is implicitly installed or
  6218. uninstalled as a result of this operation, a colormap-notify event is
  6219. generated on every window referencing that colormap.
  6220.  
  6221.  
  6222. (DEFUN installed-colormaps (window &key (result-type 'list))
  6223.   (DECLARE (TYPE window window)
  6224.        (TYPE type :result-type)
  6225.        (VALUES colormaps)
  6226.        (TYPE (SEQUENCE colormap) colormaps)))
  6227.  
  6228. window    Specifies the window whose screen is to be queried for its currently
  6229.         installed colormaps.
  6230.  
  6231. :result-type
  6232.         A keyword argument, that is a valid type specifier for a sub-type of
  6233.         SEQUENCE, indicating what kind of sequence should be created to
  6234.         return the installed colormaps for the specified screen.  The
  6235.         default is to return them in a list.
  6236.  
  6237. This function returns a sequence of colormap structures which are the
  6238. currently installed colormaps for the screen of the specified window.  The
  6239. order of the colormaps is not significant, and there is no explicit
  6240. indication of which colormaps are required.
  6241.  
  6242.  
  6243. (DEFUN uninstall-colormap (colormap)
  6244.   (DECLARE (TYPE colormap colormap)))
  6245.  
  6246. colormap
  6247.     The colormap that is to be uninstalled.
  6248.  
  6249. If the specified colormap is on the required list for its screen then it is
  6250. removed from the list.  As a side-effect, the colormap might be uninstalled,
  6251. and additional colormaps may be implicitly installed or uninstalled.  Which
  6252. colormaps get installed or uninstalled is server-dependent, except that the
  6253. colormaps that are still on the required list must remain installed.
  6254.  
  6255. If colormap becomes uninstalled, a colormap-notify event is generated on
  6256. every window which has colormap associated with it.  In addition, for every
  6257. other colormap that is implicitly installed or uninstalled as a result of
  6258. this operation, a colormap-notify event is generated on every window
  6259. referencing that colormap.
  6260.  
  6261.  
  6262. 6.1.3.3.  Destroying Colormaps
  6263.  
  6264.  
  6265. (DEFUN free-colormap (colormap)
  6266.   (DECLARE (TYPE colormap colormap)))
  6267.  
  6268. colormap
  6269.     Specifies the colormap which is to be freed.
  6270.  
  6271. This function deletes the association between the assigned resource id and
  6272. the specified colormap and then destroys the colormap.  However, this
  6273. function has no effect on a default colormap for a screen.  If the colormap
  6274. is installed for a screen, it is uninstalled (see section 6.4).  If a window
  6275. has the colormap associated with it then the colormap for the window is
  6276. changed to NIL, and a colormap-notify event is generated.  The colors
  6277. displayed for a window with a colormap of NIL are not defined by the
  6278. protocol.
  6279.  
  6280.  
  6281. 6.1.4  Color cells and planes
  6282.  
  6283.  
  6284. (DEFUN alloc-color-cells (colormap colors
  6285.               &key (planes 0) contiguous-p (result-type 'LIST))
  6286.   (DECLARE (TYPE colormap colormap)
  6287.        (TYPE card16 colors :planes)
  6288.        (TYPE boolean :contiguous-p)
  6289.        (TYPE type :result-type)
  6290.        (VALUES pixels plane-masks)
  6291.        (TYPE (SEQUENCE pixel) pixels)
  6292.        (TYPE (SEQUENCE mask32) plane-masks)))
  6293.  
  6294. colormap
  6295.         Specifies the colormap in which the color cells are to be allocated.
  6296.  
  6297. colors    Specifies the number of color cells to allocate.  This value must be
  6298.         greater than zero.
  6299.  
  6300. :planes    A keyword argument, whose value must be zero or greater, that
  6301.         specifies the number of planes to allocate.  The default is zero (do
  6302.         not allocate any planes).
  6303.  
  6304. :contiguous-p
  6305.         Specifies a boolean value.  You pass the value 1 if the planes must be
  6306.         contiguous or the value 0 if the planes do not need to be contiguous.
  6307.  
  6308. :result-type
  6309.         A keyword argument, that is a valid type specifier for a sub-type of
  6310.         SEQUENCE, indicating what kind of sequences should be created to
  6311.         return the pixel values of the allocated color cells and the masks
  6312.         for the allocated color planes.  The default is to return them in a
  6313.         list.
  6314.         
  6315. The alloc-color-cells function allocates read/write color cells.  The number
  6316. of colors must be positive and the number of planes nonnegative.  If colors
  6317. and planes are requested, then pixel and masks are returned.  No mask will
  6318. have any bits in common with any other mask or with any of the pixels.  By
  6319. ORing together masks and pixels, C*(2^P) distinct pixels can be produced; all
  6320. of these are allocated writable by the request.  For :gray-scale or
  6321. :pseudo-color, each mask will have exactly one bit, and for :direct-color each
  6322. will have exactly three bits.  If contiguous is True, then if all masks are
  6323. ORed together, a single contiguous set of bits will be formed for :gray-scale
  6324. or :pseudo-color, and three contiguous sets of bits (one within each pixel
  6325. subfield) for :direct-color.  The RGB values of the allocated entries are
  6326. undefined.
  6327.  
  6328.  
  6329. (DEFUN alloc-color-planes (colormap colors &key (reds 0) (greens 0) (blues 0) 
  6330.                         contiguous-p
  6331.                         (result-type 'list))
  6332.   (DECLARE (TYPE colormap colormap)
  6333.        (TYPE card16 colors :reds :greens :blues)
  6334.        (TYPE boolean :contiguous-p)
  6335.        (TYPE type :result-type)
  6336.        (VALUES (SEQUENCE pixel) red-mask green-mask blue-mask)
  6337.        (TYPE card16  red-mask green-mask blue-mask)))
  6338.  
  6339. colormap
  6340.         Specifies the colormap ID for whose planes will be allocated.
  6341.  
  6342. colors    A positive number of pixel values that are to be returned by the pixel
  6343.     list.
  6344.  
  6345. :reds 
  6346. :greens 
  6347. :blues    Specify the number of red, green, and blue colors (shades).  The
  6348.     value you pass must be non-negative.
  6349.  
  6350. :contiguous-p
  6351.         T if the planes must be contiguous or NIL if the planes do not need to
  6352.         be contiguous.
  6353.  
  6354. :result-type
  6355.     The form in which the results are to be returned. The default is list.
  6356.  
  6357.  
  6358. The specified number of colors must all be positive while reds, greens, and
  6359. blues must be non-negative.  If colors (C), reds (R), greens (R), and blues
  6360. (B) are requested, then the pixel sequence (which defaults to a list) is
  6361. returned along with the red-mask, green-mask, and blue-mask.  If contiguous is
  6362. True, then each mask will have a contiguous set of bits.  All mask bits are
  6363. mutually exclusive; that is to say that no mask will have any bits set in
  6364. common with any other mask.  For :direct-color, each mask will lie within the
  6365. corresponding pixel subfield.  By ORing together subsets of masks with pixels,
  6366. C*(2^(R+G+B)) distinct pixels can be produced; all of these are allocated by
  6367. the request.  The initial RGB values of the allocated entries are undefined.
  6368. In the colormap there are only C*(2^R) independent red entries, C*(2^G)
  6369. independent green entries, and C*(2^B) independent blue entries.  This is also
  6370. true for :pseudo-color.  When the colormap entry for a pixel value is changed
  6371. using store-colors or store-named-color, the pixel is decomposed according to
  6372. the masks and the corresponding independent entries are updated.
  6373.  
  6374.  
  6375.  
  6376. 6.2    Manipulating Colors
  6377.  
  6378.  
  6379. CLX provides functions with which you can allocate color values for pixels
  6380. that you need to display and can deallocate them when they are no longer
  6381. needed.  There are two ways of allocating color cells: explicitly as read only
  6382. entries by pixel value or read/write, where you can allocate a number of color
  6383. cells and planes simultaneously.  The read/write cells you allocate do not
  6384. have defined colors until set with store-color or store-colors.
  6385.  
  6386. The query-colors returns the red, green, and blue color values stored in the
  6387. specified colormap.  The values returned for an unallocated entry are
  6388. undefined.
  6389.  
  6390. To determine the color names, the X server uses a color data base.  Although
  6391. you can change the values in a read/write color cell that is allocated by
  6392. another application, this is considered "anti-social" behavior.
  6393.  
  6394.  
  6395. (DEFUN store-color (colormap pixel spec &key (red-p T) (green-p T) (blue-p T))
  6396.   (DECLARE (TYPE colormap colormap)
  6397.        (TYPE pixel pixel)
  6398.        (TYPE (OR stringable color) spec)
  6399.        (TYPE boolean :red-p :green-p :blue-p)))
  6400.  
  6401. colormap
  6402.     Specifies the colormap that receives the color.
  6403.  
  6404. pixel    Specifies the pixel index into the colormap.
  6405.  
  6406. spec    Specifies whether the color of the referenced pixel is referred to by
  6407.     stringable name (i.e. "red"") or an RGB color structure.
  6408. :red-p 
  6409. :green-p 
  6410. :blue-p    Are optional keywords that when NIL, cause that color (red-p, etc.) to
  6411.         be ignored when updating colormap.  However, if spec is a stringable
  6412.         then the keywords are ignored.
  6413.  
  6414.  
  6415. Store-color changes the colormap pixel index to the color described in spec.
  6416. Spec may be either an RGB color structure or a stringable.  When spec is a
  6417. stringable, the protocol does not specify id the stringables are first
  6418. resolved and then a single store-colors protocol request is issued, or whether
  6419. multiple store-colors protocol requests are issued.  The keywords: red-p,
  6420. green-p, and blue-p indicate which color components of pixel should actually
  6421. be changed.  If the colormap is an installed map for its screen, the changes
  6422. are visible immediately.
  6423.  
  6424.  
  6425.  
  6426. (DEFUN store-colors (colormap specs &key (red-p T) (green-p T) (blue-p T))
  6427.   (DECLARE (TYPE colormap colormap)
  6428.        (TYPE (repeat-seq (pixel pixel)
  6429.                  ((OR stringable color) color)) specs)
  6430.        (TYPE boolean :red-p :green-p :blue-p)))
  6431.  
  6432. colormap
  6433.     Specifies the colormap in which the colormap pixel entries presented
  6434.     in specs will be written upon.
  6435.  
  6436. specs    Specifies 2-tuple list of of the form ((pixel# color)..) where pixel is
  6437.         the pixel number to get the color, and color is either a stringable
  6438.     name (i.e. "red") or an RGB color structure.
  6439. :red-p
  6440. :green-p 
  6441. :blue-p    Are optional keywords that when NIL, cause that color (red-p, etc.) to
  6442.         be ignored when updating colormap.  However, if specs contains a
  6443.         stringable then the keywords are ignored.
  6444.  
  6445.  
  6446. Store-colors changes multiple colormap pixel indices to the colors described
  6447. in spec.  Spec is a sequence of a paired list of pixel-index and color-spec of
  6448. the form ((pixel#,spec)...) As in store-color, spec may be either an RGB color
  6449. structure or a stringable.  When spec is a stringable, the protocol does not
  6450. specify if the stringables are first resolved and then a single store-colors
  6451. protocol request is issued, or whether multiple store-colors protocol requests
  6452. are issued.  The keywords: red-p, green-p, and blue-p indicate which color
  6453. components for all of pixels described in spec should actually be changed.  If
  6454. the colormap is an installed map for its screen, the changes are visible
  6455. immediately.
  6456.  
  6457.  
  6458. To emulate an XLib StoreNamedColor request use store-color or store colors
  6459. with the color spec as a stringable.
  6460.  
  6461.  
  6462.  
  6463. (DEFUN free-colors (colormap pixels &OPTIONAL (plane-mask 0))
  6464.   (DECLARE (TYPE colormap colormap)
  6465.        (TYPE (SEQUENCE pixel) pixels)
  6466.        (TYPE pixel plane-mask)))
  6467.  
  6468. colormap 
  6469.     Specifies the colormap on which pixels will be cleared.
  6470.  
  6471. pixels    specifies a sequence (usually of integers) of colormap pixel indices
  6472.     to free.
  6473.  
  6474. plane-mask
  6475.     Specifies the planes you want to free.
  6476.  
  6477. The free-colors function frees the cells in colormap represented by pixels.
  6478. Planes should not have any bits in common with any of the indices in pixels.
  6479. The set of all pixels is produced by ORing together subsets of the planes
  6480. argument with the pixels.  The request frees all of these pixels that were
  6481. allocated by the client using alloc-color, alloc-colors, alloc-color-cells,
  6482. and alloc-color-planes.  Note that freeing an individual pixel obtained from
  6483. alloc-color-planes may not actually allow it to be reused until all of its
  6484. "related" pixels are also freed.
  6485.  
  6486. All specified pixels that are allocated by the client in colormap are freed,
  6487. even if one or more pixels produce an error.  An error is generated if a
  6488. specified pixel is not a valid index into colormap.  Another error is
  6489. generated if a specified pixel is not allocated by the client (that is, is
  6490. unallocated or is only allocated by another client).  If more than one pixel
  6491. is in error, the one reported is arbitrary.
  6492.  
  6493.  
  6494. 6.3.    Pixmaps
  6495.         
  6496.  
  6497. A "pixmap" is a three dimensional array of bits.  A pixmap is normally thought
  6498. of as a two dimensional array of pixels, where each pixel can be a value from
  6499. 0 to 2N-1, where N is the depth (z axis) of the pixmap.  A pixmap can also be
  6500. thought of as a stack of N bitmaps.  CLX provides functions with which you
  6501. can: create or free a pixmap, test if an object is a pixmap, test if two
  6502. pixmap objects are equal, or return the pixmap resource-ID from a pixmap
  6503. object.
  6504.  
  6505. Pixmaps can only be used on the screen on which they were created.  Pixmaps
  6506. are off-screen resources that are used for a number of operations.  A bitmap
  6507. is a single bit pixmap.  These include defining cursors as tiling patterns or
  6508. as the source for certain raster operations.  Most graphic requests can
  6509. operate either on a window or on a pixmap.
  6510.  
  6511.  
  6512. (DEFUN create-pixmap (&key width height depth drawable)
  6513.   (DECLARE (TYPE card16 :width :height)
  6514.            (TYPE card8 :depth)
  6515.            (TYPE drawable :drawable)
  6516.            (VALUES pixmap?)
  6517.        (TYPE pixmap pixmap?)))
  6518.  
  6519. :width
  6520. :height  Specify the width and height.  These dimensions define the width and
  6521.         height of the pixmap.  The values you pass must be nonzero.
  6522.  
  6523. :depth   Specifies the depth of the pixmap.  The depth must be supported by
  6524.         the root of the specified drawable.
  6525.  
  6526. :drawable
  6527.         Specifies the drawable which you are interested in setting the
  6528.         stipple or tile for.
  6529.  
  6530.  
  6531. The create-pixmap function creates a pixmap of the width, height, and depth
  6532. you specify and assigns the pixmap ID (PID) to it.  It is valid to pass a
  6533. window whose class is Input-Only to the drawable argument.  The width and
  6534. height arguments must be nonzero.
  6535.  
  6536.  
  6537. (DEFUN free-pixmap (pixmap)
  6538.   (DECLARE (TYPE pixmap pixmap)))
  6539.  
  6540. pixmap  Specifies the pixmap to be freed.
  6541.  
  6542. The Free-Pixmap function first deletes the association between the pixmap ID
  6543. and the pixmap.  Then, the X server frees the pixmap storage when no other
  6544. resources reference it.  The pixmap should never be referenced again.
  6545. Free-Pixmap can generate a Bad-Pixmap error.
  6546.  
  6547.  
  6548. (DEFUN pixmap-p (pixmap)
  6549.    (DECLARE (TYPE pixmap pixmap)
  6550.         (VALUES boole)
  6551.         (TYPE boolean boole)))
  6552.  
  6553. pixmap    A three dimensional array of bits which is tested as a pixmap object.
  6554.  
  6555. This function returns a boolean; T if the argument is a pixmap object and NIL
  6556. otherwise.
  6557.  
  6558.  
  6559. (DEFUN pixmap-id (pixmap)
  6560.    (DECLARE (TYPE pixmap pixmap)
  6561.         (VALUES id)
  6562.         (TYPE resource-id id)))
  6563.  
  6564. pixmap    A three dimensional array of bits whose ID is returned.
  6565.  
  6566. This function returns the unique resource-id that has been assigned to the
  6567. specified pixmap by the server.
  6568.  
  6569.  
  6570. (DEFUN pixmap-equal (pixmap-1 pixmap-2)
  6571.    (DECLARE (TYPE pixmap pixmap-1 pixmap-2)))
  6572.  
  6573. pixmap-1
  6574. pixmap-2
  6575.     A three dimensional array of bits to be tested.
  6576.  
  6577. This function returns T if the two arguments are equivalent pixmaps and NIL if
  6578. they are not.
  6579.  
  6580.  
  6581.  
  6582. ****----preliminary section designations
  6583.  
  6584.     6.4. Manipulating Graphics Context/State 
  6585.  
  6586.     6.5. Using GC Convenience Routines 
  6587.  
  6588.     6.5.1. Setting the Foreground, Background, Plane Mask, or Function
  6589.  
  6590.     6.5.2. Setting the Line Attributes and Dashes
  6591.  
  6592.     6.5.3. Setting the Fill Style and File Rule
  6593.  
  6594.     6.5.4. Setting the Fill Tile and Stipple
  6595.  
  6596.     6.5.5. Setting the Current Font
  6597.  
  6598.     6.5.6. Setting the Clip Region
  6599.  
  6600.     6.5.7. Setting the Arc Mode, Subwindow Mode, and Graphics Exposure
  6601.  
  6602.  
  6603.  
  6604.  
  6605.  
  6606.                   Chapter 7
  6607.  
  6608.                              Graphic Operations
  6609.  
  6610.  
  6611. Once you have connected to the X server, you can use CLX functions to
  6612. perform graphic operations on drawables.  If the same drawable and graphic
  6613. context is used, CLX batches back to back calls to draw-point, draw-line,
  6614. draw-rectangle, draw-arc, and friends to speed server processing.
  6615.  
  6616. This chapter describes the CLX functions that you may use to:
  6617.  
  6618. o    Operate on areas and planes
  6619.  
  6620. o    Draw points
  6621.  
  6622. o    Draw lines
  6623.  
  6624. o    Draw rectangles
  6625.  
  6626. o    Draw arcs
  6627.  
  6628.  
  6629. 7.1.  Area and Plane Operations
  6630.  
  6631. CLX provides functions with which you can clear an area or an entire window
  6632. to the background.  Because pixmaps do not have backgrounds, they cannot be
  6633. filled by using the functions described in this section.  Instead, you
  6634. should use draw-rectangle, which sets the pixmap to a known value.  See
  6635. Section 7.4  for information on draw-rectangle.
  6636.  
  6637.  
  6638. (DEFUN clear-area (window &key (x 0) (y 0) width height exposures-p)
  6639.   (DECLARE (TYPE window window)
  6640.            (TYPE int16 :x :y)
  6641.            (TYPE (OR NULL card16) :width :height)
  6642.            (TYPE boolean :exposures-p)))
  6643.  
  6644. window  The window which is to have an area cleared.
  6645.  
  6646. :x
  6647. :y    Specify the upper-left hand corner of the area to be cleared.  These
  6648.         coordinates are relative to the window origin.
  6649.  
  6650. :width  The width of the area to clear or NIL to clear to the remaining
  6651.         width of the window.
  6652.  
  6653. :height The height of the area to clear or NIL to clear to the remaining
  6654.         height of the window.
  6655.  
  6656. :exposures-p
  6657.         Specifies if exposure events should be generated for the affected
  6658.         areas.
  6659.  
  6660. This function paints a rectangular area in the specified window with the
  6661. background pixel or pixmap of the window.  The x and y coordinates are
  6662. relative to the window origin, and specify the upper left corner of the
  6663. rectangular area that is to be cleared.  A NIL or zero value for height or
  6664. width clears the remaining area (height-y or width-x).  If the window has a
  6665. defined background tile, the rectangle is tiled by using a plane-mask of all
  6666. ones and a function of :copy.  If the window has background :none, the
  6667. contents of the window are not changed.  In either case, if exposures-p is
  6668. non-null, then one or more exposure events are generated for regions of the
  6669. rectangle that are either visible or are being retained in a backing store.
  6670.  
  6671. To clear the entire area in a specified window, use (clear-area window).
  6672.  
  6673.  
  6674. (DEFUN copy-area (src gcontext src-x src-y width height dst dst-x dst-y)
  6675.   (DECLARE (TYPE drawable src dst)
  6676.            (TYPE gcontext gcontext)
  6677.            (TYPE int16 src-x src-y dst-x dst-y)
  6678.            (TYPE card16 width height)))
  6679.  
  6680. src    Specifies the source drawable from which to copy the area from.
  6681.  
  6682. gcontext
  6683.         The graphic context to use during the copy operation.
  6684.  
  6685. src-x 
  6686. src-y   Specify the x and y coordinates of the upper left corner of the area
  6687.         in the source drawable which is to be copied.  These coordinates are
  6688.         relative to the source drawables origin.
  6689.  
  6690. width 
  6691. height  The width and height of the area being copied.  These apply to both
  6692.     the source and destination areas.
  6693.  
  6694. dst     Specifies the destination drawable that is to be copied to.
  6695.  
  6696. dst-x 
  6697. dst-y   Specify the x and y coordinates of the upper left corner of the area
  6698.         in the destination drawable which is to be copied to.  These
  6699.         coordinates are relative to the destination drawables origin.
  6700.  
  6701. This function copies the specified rectangular area from the source drawable
  6702. to the specified rectangular area of the destination drawable, combining
  6703. them as specified in the supplied graphic context.  The x and y coordinates
  6704. are relative to their respective drawable origin, with each pair specifying
  6705. the upper left corner of the area.
  6706.  
  6707. If either regions of the source area are obscured and have not been retained
  6708. in backing store or regions outside the boundaries of the source drawable
  6709. are specified, those regions are not copied.  Instead, the following occurs
  6710. on all corresponding destination regions that are either visible or are
  6711. retained in backing store.  If the destination rectangle is a window with a
  6712. background other than :none, these corresponding regions of the destination
  6713. are tiled, using plane-mask of all ones and function of BOOLE-1 (copy), with
  6714. that background.  Regardless of tiling or whether the destination is a
  6715. window or a pixmap, if the exposures attribute of the graphic context is
  6716. :on, then graphics-expose events for all corresponding destination regions
  6717. are generated.  If exposures is :on but no regions are exposed, a no-expose
  6718. event is generated.  Note that by default, exposures is :on on in new
  6719. graphic contexts.  See chapter 5 for further information.
  6720.  
  6721.  
  6722. (DEFUN copy-plane (src gcontext plane src-x src-y width height dst dst-x
  6723.            dst-y) 
  6724.   (DECLARE (TYPE drawable src dst)
  6725.            (TYPE gcontext gcontext)
  6726.            (TYPE pixel plane)
  6727.            (TYPE int16 src-x src-y dst-x dst-y)
  6728.            (TYPE card16 width height)))
  6729.  
  6730. src     Specifies the source drawable from which to copy the area from.
  6731.  
  6732. gcontext
  6733.         The graphic context to use during the copy operation.
  6734.  
  6735. plane   Specifies the bit-plane of the source drawable that is to be copied.
  6736.         Exactly one bit must be set.
  6737.  
  6738. src-x
  6739. src-y   Specify the x and y coordinates of the upper left corner of the area
  6740.         in the source drawable which is to be copied.  These coordinates are
  6741.         relative to the source drawables origin.
  6742.  
  6743. width
  6744. height  The width and height of the area being copied.  These apply to both
  6745.     the source and destination areas.
  6746.  
  6747. dst     Specifies the destination drawable that is to be copied to.
  6748.  
  6749. dst-x 
  6750. dst-y   Specify the x and y coordinates of the upper left corner of the area
  6751.         in the destination drawable which is to be copied to.  These
  6752.         coordinates are relative to the destination drawables origin.
  6753.  
  6754. The copy-plane function uses a single bit plane of the specified rectangular
  6755. area of the source drawable along with the specified graphic context to
  6756. modify the specified rectangle area of the destination drawable.  The
  6757. drawables specified by the src and dst arguments must have the same root but
  6758. need not have the same depth.
  6759.  
  6760. Effectively, this operation forms a pixmap of the same depth as dst and with
  6761. a size specified by the source area.  It then uses the foreground and
  6762. background from the graphic context (foreground everywhere the bit-plane in
  6763. src contains a one bit, background everywhere the bit-plane in src contains
  6764. a zero bit) and the equivalent of a copy-area operation is performed with
  6765. all the same exposure semantics.  This can also be thought of as using the
  6766. specified region of the source bit-plane as a stipple with a fill-style of
  6767. :opaque-stippled for filling a rectangular area of the destination.
  6768.  
  6769.  
  6770. 7.2.  Drawing Points
  6771.  
  6772. The Draw-Point and Draw-Points functions make use of the following
  6773. graphic contexts: function, plane-mask, foreground, subwindow-mode, clip-x, clip-y,
  6774. clip-ordering, clip-region and clip-mask.
  6775.  
  6776. The Draw-Point function uses the foreground pixel and function components of
  6777. the graphic context to draw a single point into the specified drawable,
  6778. while Draw-Points draws multiple points into the specified drawable.  These
  6779. functions are not affected by the tile or stipple in the graphic context.
  6780.  
  6781.  
  6782. (DEFUN draw-point (drawable gcontext x y)
  6783.   (DECLARE (TYPE drawable drawable)
  6784.            (TYPE gcontext gcontext)
  6785.            (TYPE int16 x y)))
  6786.  
  6787.  
  6788. drawable
  6789.         Specifies the drawable which will get the point.
  6790.  
  6791. gcontext
  6792.         Specifies the graphic context.
  6793.  
  6794. y       Specifies the x and y coordinates where you want the
  6795.         point drawn.
  6796.  
  6797.  
  6798. When using Draw-Point, you simply specify the x and y coordinates where you
  6799. want the point drawn.  Draw-Point then combines the foreground pixel in the
  6800. graphic context with the pixel in the drawable.  The point specified by the x and y
  6801. coordinates is always relative to the drawables origin.
  6802.  
  6803.  
  6804.  
  6805. (DEFUN draw-points (drawable gcontext points &optional relative-p)
  6806.   (DECLARE (TYPE drawable drawable)
  6807.            (TYPE gcontext gcontext)
  6808.            (TYPE point-seq points)
  6809.            (TYPE boolean relative-p)))
  6810.  
  6811. drawable 
  6812.         Specifies the drawable which the list of points are to
  6813.         be drawn upon.
  6814.  
  6815. gcontext
  6816.         Specifies the graphic context in which the points are
  6817.         to be drawn.
  6818.  
  6819. points  A list of points to be drawn in the the order listed.
  6820.         The first point is always relative to the drawables origin; if
  6821.         relative-p, the rest of the points are drawn relative to the
  6822.         previous point, else they are drawn relative to the origin of
  6823.         drawable.
  6824.  
  6825. relative-p
  6826.         specifies the coordinate mode used for drawing the pixels either
  6827.         relative to the origin or the previous point.
  6828.  
  6829.  
  6830. Draw-Points combines the foreground pixels in the graphic context with the pixels
  6831. at each point in the drawable.  The points are drawn in the order listed.
  6832.  
  6833. Draw-Points requires a mode argument, relative-p, that indicates whether the
  6834. points are relative to the drawables origin or to the previous point.  In
  6835. either case, The first point is always relative to the drawables origin; the
  6836. rest of the points are relative either to the drawables origin or to the
  6837. previous point, depending on the value of relative-p.
  6838.  
  6839.  
  6840. 7.3.  Drawing Lines
  6841.         
  6842. All three functions: Draw-Line, Draw-Lines, and Draw-Segments use these
  6843. graphic context components: function, plane-mask, line-width, line-style,
  6844. cap-style, fill-style, subwindow-mode, clip-x-origin, clip-y-origin, and
  6845. clip-mask.  The Draw-Lines function also uses the join-style graphic
  6846. context component.  All three functions use these graphic context
  6847. mode-dependent components: foreground, background, tile, stipple,
  6848. ts-x-origin, ts-y-origin, dash-offset, and dash-list.  See the general
  6849. discussion under create-gcontext in Section 5.1.
  6850.  
  6851.  
  6852. (DEFUN draw-line (drawable gcontext x1 y1 x2 y2 &optional relative-p)
  6853.   (DECLARE (TYPE drawable drawable)
  6854.            (TYPE gcontext gcontext)
  6855.            (TYPE int16 x1 y1 x2 y2)
  6856.            (TYPE boolean relative-p)))
  6857.  
  6858. drawable        
  6859.         Specifies the drawable which is to get the line.
  6860.  
  6861. gcontext
  6862.         Specifies the graphic context under which the line will be drawn.
  6863.  
  6864. x1
  6865. y1
  6866. x2
  6867. y2      Specifies the points used to connect the line.  Thus, Draw-Line
  6868.         draws a line connecting point x1, y1 to point x2, y2.
  6869.  
  6870. relative-p
  6871.         specifies the coordinate mode used for drawing the line either
  6872.         relative to the origin or the previous point.  In either case, the
  6873.         first point is always drawn relative to the origin of the drawable.
  6874.  
  6875.  
  6876. (DEFUN draw-lines (drawable gcontext points &key relative-p fill-p (shape :complex))
  6877.   (DECLARE (TYPE drawable drawable)
  6878.            (TYPE gcontext gcontext)
  6879.            (TYPE point-seq points)
  6880.            (TYPE boolean :relative-p :fill-p)
  6881.            (TYPE (MEMBER :complex :non-convex :convex) :shape)))
  6882.  
  6883. drawable        
  6884.         Specifies the drawable which is to receive the poly lines.
  6885.  
  6886. gcontext
  6887.         Specifies the graphic context under which the lines will be drawn.
  6888.  
  6889.  
  6890. points  Specifies a list of points that define the lines which will be
  6891.         drawn.  The points are either relative to the origin or the previous
  6892.         point, depending on the value of relative-p.
  6893.  
  6894. :relative-p 
  6895.         Specifies the coordinate mode as related to the origin, or as
  6896.         relative to the previous point.  In either case, the first point is
  6897.         always drawn relative to the origin.
  6898.  
  6899. :fill-p    When true, a filled polygon is drawn instead of a polyline.
  6900.  
  6901. :shape    is a hint that allows the server to use the most efficient area fill
  6902.     algorithm. Shape may be either :convex :non-convex or :complex.
  6903.  
  6904.  
  6905. Draw-lines draws poly lines between each pair of points in the points list.
  6906. The lines are drawn in the order listed and join correctly at all
  6907. intermediate points.  The Join-style graphic context is used to define the type of
  6908. joint to use.  When the first and last points coincide the first and last
  6909. lines also join correctly to produce a hollow polygon.
  6910.  
  6911. When relative-p is true, the first point is always relative to the
  6912. drawables origin; the rest are relative to the previous point.  When
  6913. relative-p is NIL, the rest of the points are drawn relative to the
  6914. drawables origin.
  6915.  
  6916. When :fill-p is True, the polygon defined by the points list in points is to
  6917. be filled.  The :shape keyword provides the server with a hint as to how to
  6918. best approach the fill operation.  :Shape may be either :complex (by default),
  6919. :convex, or non-convex.  
  6920.  
  6921. The :convex operand is the simplest type of area and the fastest to fill.  A
  6922. fill area is convex if every straight line connecting any two interior points
  6923. is entirely inside the area.  For example, triangles and rectangles are convex
  6924. polygons.
  6925.  
  6926. The :non-convex operand is for filling an area that is not convex and is also
  6927. not self-intersecting.  Filling this type of area is harder than filling a
  6928. convex area, but easier than filling one that is self-intersecting.  For
  6929. example, the shape of the letter "T" is non-convex and non-self-intersecting.
  6930.  
  6931. The :complex operand is the most general (and therefore the hardest) type of
  6932. fill area.  A complex fill area may be non-convex and self-intersecting.  For
  6933. example, draw the outline of a bow tie, without lifting your pencil or tracing
  6934. over an edge twice.  This shape is non-convex and intersects itself at the
  6935. "knot" in the middle.  
  6936.  
  6937. Note: unless you are sure that a shape is :convex or :non-convex, it should
  6938. always be drawn as a :complex shape.  If :convex or :non-convex is specified
  6939. incorrectly, the graphic result is undefined.
  6940.  
  6941.  
  6942. (DEFUN draw-segments (drawable gcontext segments)
  6943.   (DECLARE (TYPE drawable drawable)
  6944.            (TYPE gcontext gcontext)
  6945.            (TYPE seg-seq segments)))
  6946.  
  6947. drawable        
  6948.         Specifies the drawable which will receive the line segments.
  6949.  
  6950. gcontext
  6951.         Specifies the graphic context under which the line segments will be
  6952.         drawn. 
  6953.  
  6954. segments
  6955.         Specifies the points list from which to draw the segments.
  6956.  
  6957.  
  6958. The draw-segments function uses the components of the specified graphic
  6959. context to draw multiple, but not necessarily connected lines.  For each
  6960. segment, draw-segments draws a line between (x1, y1) and (x2, y2).  The
  6961. lines are drawn in the order listed in the Segments variable.  Unlike
  6962. draw-lines above, no joining is performed at coincident end points For any
  6963. given line, no pixel is drawn more than once.  If lines intersect, then the
  6964. intersecting pixels are drawn multiple times.
  6965.  
  6966.  
  6967. 7.4.  Drawing Rectangles
  6968.  
  6969.  
  6970. The Draw-Rectangle and Draw-Rectangles functions draw hollow or filled
  6971. outlines of the specified rectangle or rectangles as if a five-point
  6972. PolyLine were specified each rectangle:
  6973.  
  6974.         [x,y,] [x+width,y] [x+width,y+height] [x,y+height] [x,y]
  6975.  
  6976. Draw-Rectangle and Draw-Rectangles use these graphic context components:
  6977. function, plane-mask, line-width, line-style, join-style, fill-style,
  6978. subwindow-mode, clip-x, clip-y, and clip-mask.  Both functions also use
  6979. these graphic context mode-dependent components: foreground, background,
  6980. tile, stipple, ts-x-origin, ts-y-origin, dash-offset, and dash-list.  See
  6981. the discussion under create-gcontext in Chapter 5.
  6982.  
  6983.  
  6984. (DEFUN draw-rectangle (drawable gcontext x y width height &optional fill-p)
  6985.   (DECLARE (TYPE drawable drawable)
  6986.            (TYPE gcontext gcontext)
  6987.            (TYPE int16 x y)
  6988.            (TYPE card16 width height)
  6989.            (TYPE boolean fill-p)))
  6990.  
  6991. drawable        
  6992.         Specifies the drawable which will receive the rectangle.
  6993.  
  6994. gcontext
  6995.         Specifies the graphic context under which the rectangle will be
  6996.         drawn.
  6997.  
  6998. x y     Specifies the x and y coordinates that define the upper left corner
  6999.         of the rectangle.  The coordinates are relative to the windows
  7000.         origin.
  7001.  
  7002. width 
  7003. height  Specify the width and height that define the outline of
  7004.         the rectangle.
  7005.  
  7006. fill-p  Specified whether the rectangle will be filled or hollow. 
  7007.  
  7008.  
  7009. (DEFUN draw-rectangles (drawable gcontext rectangles &optional fill-p)
  7010.   (DECLARE (TYPE drawable drawable)
  7011.            (TYPE gcontext gcontext)
  7012.            (TYPE rect-seq rectangles)
  7013.            (TYPE boolean fill-p)))
  7014.  
  7015.  
  7016. drawable        
  7017.         Specifies the drawable which will receive the rectangles.
  7018.  
  7019. gcontext
  7020.         Specifies the graphic context under which the rectangle will be
  7021.         drawn.
  7022.  
  7023. rectangles
  7024.         a LIST of rectangles specifying the upper left corner
  7025.         X and Y, width and height of the rectangles to be drawn.
  7026.  
  7027. fill-p  Specified if the rectangles are to be filled or not. 
  7028.  
  7029.  
  7030. For the specified rectangle or rectangles, no pixel is drawn more than once.
  7031. The x and y coordinates of each rectangle are relative to the drawables
  7032. origin and define the upper left corner of the rectangle.  Draw-Rectangles
  7033. draws the rectangles in the order listed in the array.  If rectangles
  7034. intersect, the intersecting pixels are drawn multiple times.
  7035.  
  7036.  
  7037. 7.5.  Drawing Arcs
  7038.  
  7039. Draw-Arc draws a single circular or elliptical arc, while Draw-Arcs draws
  7040. multiple circular or elliptical arcs.  Draw-Arc and Draw-Arcs use these
  7041. graphic context components: function, plane-mask, line-width, line-style,
  7042. cap-style, join-style, fill-style, subwindow-mode, clip-x, clip-y, and
  7043. clip-mask.  Both functions also use these graphic context mode-dependent
  7044. components: foreground, background, tile, stipple, ts-x-origin, ts-y-origin,
  7045. dash-offset, and dash-list.
  7046.  
  7047.  
  7048.  
  7049. (DEFUN draw-arc (drawable gcontext x y width height angle1 angle2 &optional fill-p)
  7050.   (DECLARE (TYPE drawable drawable)
  7051.            (TYPE gcontext gcontext)
  7052.            (TYPE int16 x y)
  7053.            (TYPE card16 width height)
  7054.            (TYPE angle angle1 angle2)
  7055.            (TYPE boolean fill-p)))
  7056.  
  7057.  
  7058. drawable
  7059.         Specifies the drawable which will receive the arc.
  7060.  
  7061. gcontext
  7062.         Specifies the graphic context to draw the arc with.
  7063.  
  7064. x
  7065. y       Specify the x and y coordinates.  These are the coordinates of the
  7066.         arc and are relative to the ORIGIN of the drawable.  These
  7067.         coordinates also specify the upper left corner of the rectangle.
  7068.  
  7069. width
  7070. height  Specify the width and height.  These are the major and minor axes of
  7071.         the arc.
  7072.  
  7073. angle1  Specifies the start of the arc relative to the three-o-clock
  7074.         position from the center, in units of radians and bounded by (* -2 pi)
  7075.         and (* 2 pi).
  7076.  
  7077. angle2  Specifies the path and extent of the arc relative to the start of
  7078.         the arc, in units of radians and bounded by (* -2 pi) and (* 2 pi).
  7079.  
  7080. fill-p  Specifies whether the arc is to be drawn as an outline or to be
  7081.         drawn filled.
  7082.  
  7083. Draw-arc draws either circular or elliptical, outlined or filled arcs.  Each
  7084. arc is specified by a rectangle and two angles.  The angles are signed
  7085. integers in radians, with positive indicating counterclockwise motion and
  7086. negative indicating clockwise motion.  The start of the arc is specified by
  7087. angle1 relative to the three-o'clock position from the center of the rectangle,
  7088. and the path and extent of the arc is specified by angle2 relative to the
  7089. start of the arc.  If the magnitude of angle2 is greater than 360 degrees, it
  7090. is truncated to 360 degrees.  The x and y coordinates of the rectangle are
  7091. relative to the origin of the drawable.  For an arc specified as
  7092. [x,y,w,h,a1,a2], the origin of the major and minor axes is at
  7093. [x+(w/2),y+(h/2)], and the infinitely thin path describing the entire
  7094. circle/ellipse intersects the horizontal axis at [x,y+(h/2)] and
  7095. [x+w,y+(h/2)], and intersects the vertical axis at [x+(w/2),y] and
  7096. [x+(w/2),y+h].  These coordinates can be fractional, i.e., they are not
  7097. truncated to discrete coordinates.  Note that the angle values are slightly
  7098. different in CLX than in the Xlib document and the protocol specification.
  7099.  
  7100.  
  7101. (DEFUN draw-arcs (drawable gcontext arcs &optional fill-p)
  7102.   (DECLARE (TYPE drawable drawable)
  7103.            (TYPE gcontext gcontext)
  7104.            (TYPE arc-seq arcs)
  7105.            (TYPE boolean fill-p)))
  7106.  
  7107. drawable
  7108.         Specifies the drawable which will receive the arcs.
  7109.  
  7110. gcontext
  7111.         Specifies the graphic context under which the arcs will be drawn. 
  7112.  
  7113. x
  7114. y       Specify the x and y coordinates.  These are the coordinates of the
  7115.         arc and are relative to the ORIGIN of the drawable.  These
  7116.         coordinates also specify the upper left corner of the rectangle.
  7117.  
  7118. arcs    A list <?> containing the width,height,angle1, and angle2
  7119.         descriptors defining the arcs.  see draw-arc for more detail.
  7120.  
  7121. fill-p  Specifies whether the arcs are to be drawn as outlines or to be
  7122.         drawn filled.
  7123.  
  7124. Draw-arcs draws circular or elliptical, outlined or filled arcs.  Each arc
  7125. is specified by a rectangle and two angles with in the arcs parameter. 
  7126. For a more detailed description see Draw-Arc.
  7127.  
  7128. The arcs are filled in the order listed.  For any given arc, no pixel is
  7129. drawn more than once.  If regions intersect, the intersecting pixels are
  7130. drawn multiple times.
  7131.  
  7132.  
  7133.  
  7134.                    Chapter 8
  7135.  
  7136.               Events and Event-Handling Functions
  7137.  
  7138. ****----preliminary section designations
  7139.  
  7140. 8.1. Event Types 
  7141.  
  7142. 8.2. Event Structures
  7143.  
  7144. 8.3. Event Mask
  7145.  
  7146. 8.4. Event Processing
  7147.  
  7148. 8.4.1. Keyboard and Pointer Event Processing
  7149.  
  7150. 8.4.1.1. Pointer Button Specific Processing 
  7151.  
  7152. 8.4.1.2. Common Keyboard and Pointer Event Processing
  7153.  
  7154. 8.4.2. Window Entry/Exit Event Processing
  7155.  
  7156. 8.4.2.1. Normal Entry/Exit Event Processing
  7157.  
  7158. 8.4.2.2. Grab and Ungrab Entry/Exit Event Processing
  7159.  
  7160. 8.4.3. Input Focus Events
  7161.  
  7162. 8.4.3.1. Normal and While Grabbed Focus Event Processing
  7163.  
  7164. 8.4.3.2. Focus Events Generated by Grabs
  7165.  
  7166. 8.4.4. Key Map State Notification Event Processing
  7167.  
  7168. 8.4.5. Exposure Event Processing
  7169.  
  7170. 8.4.5.1. Expose Event Processing
  7171.  
  7172. 8.4.5.2. GraphicsExpose and NoExpose Event Processing
  7173.  
  7174. 8.4.6. Window State Notification Event Processing
  7175. 8.4.6.1. CirculateNotify Event Processing
  7176. 8.4.6.2. ConfigureNotify Event Processing
  7177. 8.4.6.3. CreateNotify Event Processing
  7178. 8.4.6.4. DestroyNotify Event Processing
  7179. 8.4.6.5. GravityNotify Event Processing
  7180. 8.4.6.6. MapNotify Event Processing
  7181. 8.4.6.7. MappingNotify Event Processing
  7182. 8.4.6.8. ReparentNotify Event Processing
  7183. 8.4.6.9. UnmapNotify Event Processing
  7184. 8.4.6.10. VisibilityNotify Event Processing
  7185. 8.4.7. Structure Control Event Processing
  7186. 8.4.7.1. CirculateRequest Event
  7187. 8.4.7.2. ConfigureRequest Event
  7188. 8.4.7.3. MapRequest Event
  7189. 8.4.7.4. ResizeRequest Event Processing
  7190.  
  7191. 8.4.8. Color Map State Notification Event Processing
  7192.  
  7193. 8.4.9. Client Communication Event Processing
  7194. 8.4.9.1. ClientMessage Event Processing
  7195. 8.4.9.2. PropertyNotify Event Processing
  7196. 8.4.9.3. SelectionClear Event Processing
  7197. 8.4.9.4. SelectionRequest Event Processing
  7198. 8.4.9.5. SelectionNotify Event Processing
  7199.  
  7200. 8.5. Selecting Events
  7201.  
  7202. 8.6. Handling the Output Buffer
  7203.  
  7204. 8.7.  Event Queue Management
  7205.  
  7206. 8.8. Manipulating the Event Queue
  7207.  
  7208. 8.8.1. Returning the Next Event
  7209.  
  7210. 8.8.2. Selecting Events Using a Predicate Procedure
  7211. 8.8.3. Selecting Events Using a Window or Event Mask
  7212.  
  7213. 8.9. Putting an Event Back onto the Queue
  7214.  
  7215.  
  7216. 8.10. Sending Events to Other Applications
  7217.  
  7218.  
  7219. To send an event to a specified window, use send-event.  This function is
  7220. often used in selection processing.  For example, the owner of a selection
  7221. should use send-event to send a :selection-notify event to a requestor when a
  7222. selection has been converted and stored as a property.
  7223.  
  7224.  
  7225. (DEFUN send-event (window event-key event-mask &REST args
  7226.            &KEY propagate-p display &ALLOW-OTHER-KEYS)
  7227.   (DECLARE (TYPE (OR window (MEMBER :pointer-window :input-focus)) window)
  7228.        (TYPE (OR NULL event-key) event-key)
  7229.        (TYPE event-mask event-mask)
  7230.        (TYPE boolean propagate-p)
  7231.        (TYPE (OR NULL display) display)))
  7232.  
  7233. window  Specifies the window ID.  This is the window interested in the event,
  7234.         and is referred to as the destination window.  You can pass the window
  7235.         ID or either :pointer-window or :input-focus
  7236.  
  7237. event-key
  7238.         A user defined event-key or one of the following keywords: :key-press
  7239.         :key-release :button-press :button-release :motion-notify
  7240.         :enter-notify :leave-notify :focus-in :focus-out :keymap-notify
  7241.         :exposure :graphics-exposure :no-exposure :visibility-notify
  7242.         :create-notify :destroy-notify :unmap-notify :map-notify :map-request
  7243.         :reparent-notify :configure-notify :gravity-notify :resize-request
  7244.         :configure-request :circulate-notify :circulate-request
  7245.         :property-notify :selection-clear :selection-request :selection-notify
  7246.         :colormap-notify :client-message
  7247.  
  7248. event-mask
  7249.         This mask is the bit-wise inclusive OR of one or more of the valid
  7250.         event mask bits.  It may be a user defined event-mask or one of the
  7251.         following: :button-press :button-release :enter-window :leave-window
  7252.         :pointer-motion :pointer-motion-hint :button-1-motion :button-2-motion
  7253.         :button-3-motion :button-4-motion :button-5-motion :button-motion or
  7254.         :keymap-state.
  7255.  
  7256.  
  7257. :propagate-p
  7258.         Specifies a predicate that may be either True or NIL.
  7259.  
  7260. :display
  7261.         The display device receiving the event; usually optional, however, it
  7262.         is required for :pointer-window or :input-focus window options.
  7263.  
  7264.  
  7265.  
  7266. The send-event function identifies the destination window, determines which
  7267. clients should receive the specified events, and ignores any active grabs.
  7268. Additional arguments (args) depend on event-key, and are as specified further
  7269. below with declare-event, except that both resource-ids and resource objects
  7270. are accepted in the event components.  The display argument is only required
  7271. if the window is :pointer-window or :input-focus.
  7272.  
  7273.  
  7274. If :pointer-window is specified for the window argument, the event destination
  7275. window is replaced with the window containing the pointer.
  7276.  
  7277. If :input-focus is specified for the window argument, then the focus window
  7278. will receive the event.  However, if the focus window contains a child window
  7279. which contains the pointer, the child window will receive the event and not
  7280. the focus window. In the latter case, the focus window will receive the event
  7281. only if the :propagate-p predicate is True.
  7282.  
  7283. The event-key code must be one of the core events, or one of the events
  7284. defined by an extension, so that the server can correctly byte swap the
  7285. contents as necessary.  The contents of the event are otherwise unaltered and
  7286. unchecked by the server except to force on the most significant bit of the
  7287. event-key code.
  7288.  
  7289. If the event-mask is NIL, then the event is sent to the client that created
  7290. the destination window with an event-mask of 0; if that client no longer
  7291. exists, no event is sent.
  7292.  
  7293. If :propagate-p is NIL, then the event is sent to every client selecting
  7294. on the destination window. If window is specified as :input-focus, the event
  7295. will not propagate to the focus window.
  7296.  
  7297. If :propagate-p is True and no clients have selected (on the destination)
  7298. window any of the event types in event-mask, then window is replaced with the
  7299. closest ancestor of destination for which some client has selected a type in
  7300. event-mask and no intervening window has that type in its do-not-propagate
  7301. mask.  If no such window exists, or if the window is an ancestor of the focus
  7302. window and :input-focus was originally specified as the destination, then the
  7303. event is not sent to any clients.  Otherwise, the event is reported to every
  7304. client selecting on the final destination any of the types specified in
  7305. event-mask.
  7306.  
  7307.  
  7308.  
  7309. 8.11. Getting Pointer Motion History
  7310.  
  7311. 8.12. Handling Error Events
  7312.  
  7313. 8.12.1. Enabling or Disabling Synchronization
  7314.  
  7315. 8.12.2. Using the Default Error Handlers
  7316.  
  7317.  
  7318.     Chapter 9: Window Manager Functions
  7319.  
  7320. *preliminary section designations
  7321.  
  7322.     9.1.  Changing the Parent
  7323.  
  7324.  
  7325. 9.2.  Lifetime of a Window
  7326.  
  7327. The functions described in this section are used to control the longevity of
  7328. subwindows that are normally destroyed when the parent is destroyed.  For
  7329. example, a window manager that wants to add decoration to a window by adding a
  7330. frame might reparent an application's window.  When the frame is destroyed,
  7331. the application's window should not be destroyed, but returned to its previous
  7332. place in the window hierarchy.
  7333.  
  7334. The save-set of a client is a list of other client's windows which, if they
  7335. are inferiors of one of the client's windows at connection close, should not
  7336. be destroyed and should be remapped if they are unmapped.  CLX provides the
  7337. add-to-save-set and remove-from-save-set functions to allow an application's
  7338. window to survive when a window manager that has reparented a window fails.
  7339. Although differing slightly from XLib, the CLX functions for add-to-save-set
  7340. and remove-from-save-set allow you to change a client's save-set, add a
  7341. subwindow to a client's save-set, or remove a subwindow from a client's
  7342. save-set.
  7343.  
  7344.  
  7345. Note that windows are removed automatically from the save-set by the X server
  7346. when they are destroyed.  For each window in the client's save-set, if the
  7347. window is an inferior of a window created by the client, the save-set window
  7348. is reparented to the closest ancestor such that the save-set window is not an
  7349. inferior of a window created by the client.  If the save-set window is
  7350. unmapped, a map-window request is performed on it.  After save-set processing,
  7351. all windows created by the client are destroyed.  For each non-window resource
  7352. created by the client, the appropriate Free request is performed.  All colors
  7353. and color map entries allocated by the client are freed.
  7354.  
  7355.  
  7356. (DEFUN remove-from-save-set (window)
  7357.   (DECLARE (TYPE window window)))
  7358.  
  7359. Remove-from-save-set removes the specified window from the client's
  7360. "save-set".  The window must have been created by some other client.  Windows
  7361. are removed automatically from the save-set by the server when they are
  7362. destroyed.
  7363.  
  7364.  
  7365. (DEFUN add-to-save-set (window)
  7366.   (DECLARE (TYPE window window)))
  7367.  
  7368. Add-to-save-set adds the specified window to the client's "save-set".  The
  7369. window must have been created by some other client.  Windows are removed
  7370. automatically from the save-set by the server when they are destroyed.
  7371.  
  7372.  
  7373.  
  7374.  
  7375.     9.3.  Resident Colormap Determination
  7376.  
  7377.     9.4.  Grab Operations
  7378.  
  7379.     9.4.1. Grabbing the pointer
  7380.  
  7381.     9.4.2. Grabbing a button
  7382.  
  7383.     9.4.3.  Grabbing the Keyboard
  7384.  
  7385.     9.4.4.  Grabbing a key
  7386.  
  7387.     9.4.5.  Grabbing the Server
  7388.  
  7389.  
  7390. 9.4.1. Grabbing the pointer
  7391.  
  7392.  
  7393. (DEFUN grab-pointer (window event-mask
  7394.              &KEY owner-p sync-pointer-p sync-keyboard-p 
  7395.                           confine-to cursor time)
  7396.   (DECLARE (TYPE window window)
  7397.        (TYPE pointer-event-mask event-mask)
  7398.        (TYPE boolean :owner-p :sync-pointer-p :sync-keyboard-p)
  7399.        (TYPE (OR NULL window) :confine-to)
  7400.        (TYPE (OR NULL cursor) :cursor)
  7401.        (TYPE timestamp :time)
  7402.        (VALUES grab-status)
  7403.        (TYPE (MEMBER :success :already-grabbed :invalid-time 
  7404.                          :not-viewable :frozen) grab-status)))
  7405.  
  7406. window 
  7407.     The window whose pointer is to be grabbed.
  7408.  
  7409. event-mask
  7410.         May be one of the following: :button-press :button-release
  7411.         :enter-window :leave-window :pointer-motion :pointer-motion-hint
  7412.     :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  7413.     :button-5-motion :button-motion or :keymap-state.
  7414.  
  7415. :owner-p 
  7416.     is a boolean which indicates if the window is the owner.
  7417.  
  7418. :sync-pointer-p 
  7419.     is a predicate which indicates whether the pointer is in synchronous
  7420.     or asynchronous mode. 
  7421.  
  7422. :sync-keyboard-p    
  7423.     is a predicate which indicates whether the keyboard is in synchronous 
  7424.     or asynchronous mode. 
  7425.  
  7426. :confine-to 
  7427.     indicates a window in which the pointer is confined to.
  7428.  
  7429. :cursor     The value of the cursor, or none.
  7430.     
  7431. :time    is either a timestamp or current-time
  7432.  
  7433.  
  7434. Grab-Pointer actively grabs control of the pointer.  Further pointer events
  7435. are only reported to the grabbing client.  The request overrides any active
  7436. pointer grab by this client.
  7437.  
  7438. If :owner-p is NIL, all generated pointer events are reported with respect to
  7439. window, and are only reported if selected by event-mask.  If :owner-p is True,
  7440. and if a generated pointer event would normally be reported to this client, it
  7441. is reported normally; otherwise the event is reported with respect to the
  7442. window, and is only reported if selected by event-mask.  For either value of
  7443. :owner-p, unreported events are simply discarded.
  7444.  
  7445. If :sync-pointer-p is NIL, pointer event processing continues (asynchronous)
  7446. normally; if the pointer is currently frozen by this client, then processing
  7447. of pointer events is resumed.  If :sync-pointer-p is T (indicating a
  7448. synchronous action) the pointer (as seen via the protocol) appears to freeze,
  7449. and no further pointer events are generated by the server until the grabbing
  7450. client issues a releasing allow-events request.  Actual pointer changes are
  7451. not lost while the pointer is frozen; they are simply queued for later
  7452. processing.
  7453.  
  7454. If :sync-keyboard-p is NIL, (indicating asynchronous action) keyboard event
  7455. processing is unaffected by activation of the grab.  If :sync-keyboard-p is
  7456. True, (indicating synchronous action) the keyboard (as seen via the protocol)
  7457. appears to freeze, and no further keyboard events are generated by the server
  7458. until the grabbing client issues a releasing allow-events request.  Actual
  7459. keyboard changes are not lost while the keyboard is frozen; they are simply
  7460. queued for later processing.
  7461.  
  7462. If :cursor is specified, then it is displayed regardless of what window the
  7463. pointer is in.  If :cursor is not specified, then when the pointer is in
  7464. window or one of its subwindows, the normal cursor for that window is
  7465. displayed, and otherwise the cursor for window is displayed.
  7466.  
  7467. If a :confine-to window is specified, then the pointer will be restricted or
  7468. "confined" to stay within that window.  The :confine-to window does not have to
  7469. have any relationship to the grab-window.  If the pointer is not initially in
  7470. the :confine-to window, then it is warped automatically to the closest edge
  7471. (with enter/leave events generated normally) just before the grab activates.
  7472. If the :confine-to window is subsequently reconfigured, the pointer will be
  7473. warped automatically as necessary to keep it contained in the window.
  7474.  
  7475. Grab-pointer generates enter-notify and leave-notify events.
  7476.  
  7477. Grab-pointer fails with a status of :already-grabbed if the pointer is
  7478. actively grabbed by some other client.  Grab-pointer fails with a status of
  7479. :frozen if the pointer is frozen by an active grab of another client.
  7480. Grab-pointer also fails with a status of :not-viewable if the grab-window or
  7481. the confine-to window is not viewable, or if the confine-to window lies
  7482. completely outside the boundaries of the root window.  Grab-pointer can also
  7483. fail with a status of :invalid-time if the specified time is earlier than the
  7484. last-pointer-grab time or later than the current server time.  Otherwise, the
  7485. last-pointer-grab time is set to the specified time, with current-time
  7486. replaced by the current server time, and a value of :success is returned by
  7487. grab-pointer.
  7488.  
  7489.  
  7490. (DEFUN ungrab-pointer (display &key time)
  7491.   (DECLARE (TYPE display display)
  7492.        (TYPE timestamp :time)))
  7493.  
  7494. display Specifies the display connection to the X server.
  7495.  
  7496. :time    A time stamp.
  7497.  
  7498. Ungrab-Pointer releases the pointer if this client has it actively grabbed
  7499. (from either grab-pointer or grab-button or from a normal button press), and
  7500. releases any queued events.  The request has no effect if the specified time
  7501. is earlier than the last-pointer-grab time or is later than the current server
  7502. time. An UngrabPointer is performed automatically if the event window or
  7503. confine-to window for an active pointer grab becomes not viewable.
  7504.  
  7505. This request generates enter-notify and leave-notify events.
  7506.  
  7507.  
  7508. Button grabbing
  7509.  
  7510. Buttons on the pointer may be passively "grabbed" by a client.  When the
  7511. button is pressed, the pointer is then actively grabbed by the client.
  7512.  
  7513.  
  7514. (DEFUN change-active-pointer-grab (display event-mask &OPTIONAL cursor time)
  7515.   (DECLARE (TYPE display display)
  7516.        (TYPE pointer-event-mask event-mask)
  7517.        (TYPE (OR NULL cursor) cursor)
  7518.        (TYPE timestamp time)))
  7519.  
  7520. display    Specifies the display connection to the X server. 
  7521.  
  7522. event-mask 
  7523.         May be one of the following: :button-press :button-release
  7524.         :enter-window :leave-window :pointer-motion :pointer-motion-hint
  7525.     :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  7526.     :button-5-motion :button-motion or :keymap-state.
  7527.  
  7528.  
  7529. cursor     Optional. The value of the cursor, or none.
  7530.  
  7531. time    Optional. A time stamp or current time.
  7532.  
  7533.  
  7534. Changes the specified dynamic parameters if the pointer is actively grabbed by
  7535. the client and the specified time is no earlier than the last-pointer-grab
  7536. time and no later than the current server time.  The interpretation of
  7537. event-mask and cursor are as in grab-pointer.  change-active-pointer-grab has
  7538. no effect on the passive parameters of a grab-button.
  7539.  
  7540.  
  7541. 9.4.2. Grabbing a button
  7542.  
  7543.  
  7544. (DEFUN grab-button (window button event-mask
  7545.             &KEY (modifiers 0)
  7546.              owner-p sync-pointer-p sync-keyboard-p confine-to cursor)
  7547.   (DECLARE (TYPE window window)
  7548.        (TYPE (OR (member :any) card8) button)
  7549.        (TYPE pointer-event-mask event-mask)
  7550.        (TYPE modifier-mask :modifiers)
  7551.        (TYPE boolean :owner-p :sync-pointer-p :sync-keyboard-p)
  7552.        (TYPE (OR NULL window) :confine-to)
  7553.        (TYPE (OR NULL cursor) :cursor)))
  7554.  
  7555. window 
  7556.     The window whose pointer is to be grabbed.
  7557.  
  7558. button    The button pressed or :any.
  7559.  
  7560. event-mask 
  7561.         May be one of the following: :button-press :button-release
  7562.         :enter-window :leave-window :pointer-motion :pointer-motion-hint
  7563.     :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  7564.     :button-5-motion :button-motion or :keymap-state.
  7565.  
  7566. :modifiers
  7567.         Any of the modifier-keys: :shift :lock :control :mod-1 :mod-2 :mod-3
  7568.     :mod-4 or :mod-5.
  7569.  
  7570. :owner-p 
  7571.     is a boolean which indicates if the window is the owner.
  7572.  
  7573. :sync-pointer-p 
  7574.         is a predicate which indicates whether the pointer is handled in a
  7575.     synchronous or asynchronous fashion. 
  7576.  
  7577. :sync-keyboard-p    
  7578.     is a predicate which indicates whether the keyboard is in synchronous 
  7579.     or asynchronous mode. 
  7580.  
  7581. :confine-to 
  7582.     indicates a window in which the pointer is confined to.
  7583.  
  7584. :cursor The value of the cursor, or none.
  7585.     
  7586.  
  7587. This request establishes a passive grab.  If the specified button is pressed
  7588. when the specified modifier keys are down (and no other buttons or modifier
  7589. keys are down), and window contains the pointer, and the confine-to window (if
  7590. any) is viewable, and these constraints are not satisfied for any ancestor,
  7591. then the pointer is actively grabbed as described with grab-pointer, the
  7592. last-pointer-grab time is set to the time at which the button was pressed (as
  7593. transmitted in the button-press event), and the button-press event is
  7594. reported.  The interpretation of the remaining arguments is the same as with
  7595. grab-pointer.  The active grab is terminated automatically when all buttons
  7596. are released (independent of the state of modifier keys).
  7597.  
  7598. A modifier is equivalent to issuing the request for all possible modifier-key
  7599. combinations (including the combination of no modifiers).  These are :shift
  7600. :lock :control :mod-1 :mod-2 :mod-3 :mod-4 and :mod-5.  It is not required
  7601. that all modifiers specified have currently assigned keycodes.  A button of
  7602. :any is equivalent to issuing the request for all possible buttons.
  7603. Otherwise, it is not required that the button specified currently be assigned
  7604. to a physical button.
  7605.  
  7606.  
  7607. (DEFUN ungrab-button (window button &KEY (modifiers 0))
  7608.   (DECLARE (TYPE window window)
  7609.        (TYPE (OR (member :any) card8) button)
  7610.        (TYPE modifier-mask :modifiers)))
  7611.  
  7612. window 
  7613.     The window whose pointer is to be grabbed.
  7614.  
  7615. button    The button that is released or :any.
  7616.  
  7617. :modifiers
  7618.         Any of the modifier-keys: :shift :lock :control :mod-1 :mod-2 :mod-3
  7619.     :mod-4 or :mod-5.
  7620.  
  7621. Releases the passive button/key combination on the specified window if it was
  7622. grabbed by this client.  A modifier (of the modifier-key type) is equivalent
  7623. to issuing the request for all possible modifier combinations (including the
  7624. combination of no modifiers).  A button of :any is equivalent to issuing the
  7625. request for all possible buttons.  This has no effect on an active grab.
  7626.  
  7627.  
  7628.  
  7629.  
  7630. 9.4.3.  Grabbing the Keyboard
  7631.  
  7632.  
  7633. (DEFUN grab-keyboard (window &KEY owner-p sync-pointer-p sync-keyboard-p time)
  7634.   (DECLARE (TYPE window window)
  7635.        (TYPE boolean :owner-p :sync-pointer-p :sync-keyboard-p)
  7636.        (TYPE timestamp :time)
  7637.        (VALUES grab-status)
  7638.        (TYPE (MEMBER :success :already-grabbed :invalid-time 
  7639.                          :not-viewable :frozen) grab-status)))
  7640.  
  7641.  
  7642. window 
  7643.     The window whose pointer is to be grabbed.
  7644.  
  7645. :owner-p 
  7646.     is a boolean which indicates if the window is the owner.
  7647.  
  7648. :sync-pointer-p 
  7649.     is a predicate which indicates whether the pointer is in synchronous
  7650.     or asynchronous mode. 
  7651.  
  7652. :sync-keyboard-p    
  7653.     is a predicate which indicates whether the keyboard is in synchronous 
  7654.     or asynchronous mode. 
  7655.     
  7656. :time    is either a timestamp or current-time
  7657.  
  7658.  
  7659. Grab-Keyboard actively grabs control of the keyboard.  Further key events are
  7660. reported only to the grabbing client.  The request overrides any active
  7661. keyboard grab by this client.
  7662.  
  7663. If owner-p is NIL, all generated key events are reported with respect to
  7664. window.  If owner-p is True, then if a generated key event would normally be
  7665. reported to this client, it is reported normally; otherwise the event is
  7666. reported with respect to the window.  Both :key-press and :key-release events
  7667. are always reported, independent of any event selection made by the client.
  7668.  
  7669. If sync-keyboard-p is NIL (Asynchronous), keyboard event processing continues
  7670. normally; if the keyboard is currently frozen by this client, then processing
  7671. of keyboard events is resumed.  If sync-keyboard-p is True (Synchronous), the
  7672. keyboard (as seen via the protocol) appears to freeze, and no further keyboard
  7673. events are generated by the server until the grabbing client issues a
  7674. releasing Allow-events request.  Actual keyboard changes are not lost while the
  7675. keyboard is frozen; they are simply queued for later processing.
  7676.  
  7677. If sync-pointer-p is NIL (asynchronous), pointer event processing is
  7678. unaffected by activation of the grab.  If sync-pointer-p is True
  7679. (synchronous), the pointer (as seen via the protocol) appears to freeze, and
  7680. no further pointer events are generated by the server until the grabbing
  7681. client issues a releasing Allow-events request.  Actual pointer changes are not
  7682. lost while the pointer is frozen; they are simply queued for later processing.
  7683.  
  7684. Grab-keyboard generates focus-in and focus-out events.
  7685.  
  7686. The grab can fail with a status of :already-grabbed if the keyboard is
  7687. actively grabbed by some another client.  The grab fails with a status of
  7688. :frozen if the keyboard is frozen by an active grab from another client.  The
  7689. grab can fail with a status :not-viewable if grab-window is not viewable.  The
  7690. grab can fail with a status of :invalid-time if the specified time is earlier
  7691. than the last-keyboard-grab time or later than the current server time.
  7692. Otherwise, grab-keyboard returns a status of :success and last-keyboard-grab
  7693. time is set to the specified time with current-time replaced by the current
  7694. server time.
  7695.  
  7696.  
  7697.  
  7698. (DEFUN ungrab-keyboard (display &KEY time)
  7699.   (DECLARE (TYPE display display)
  7700.        (TYPE timestamp :time)))
  7701.  
  7702. display    Specifies the display connection to the X server. 
  7703.  
  7704. :time    Optional. A timestamp or current time.
  7705.  
  7706. Releases the keyboard if this client has it actively grabbed (from either
  7707. grab-keyboard or grab-key), and releases any queued events.  The request has
  7708. no effect if the specified time is earlier than the last-keyboard-grab time or
  7709. is later than the current server time.  An Ungrab-Keyboard is performed
  7710. automatically if the event window for an active keyboard grab becomes not
  7711. viewable.
  7712.  
  7713.  
  7714.  
  7715. 9.4.4.  Grabbing a key
  7716.  
  7717.  
  7718. (DEFUN grab-key (window key &KEY (modifiers 0) owner-p sync-pointer-p sync-keyboard-p)
  7719.   (DECLARE (TYPE window window)
  7720.        (TYPE (OR (member :any) card8) key)
  7721.        (TYPE modifier-mask :modifiers)
  7722.        (TYPE boolean :owner-p :sync-pointer-p :sync-keyboard-p)))
  7723.  
  7724. window 
  7725.     The window whose key is to be grabbed.
  7726.  
  7727. key    The key to be grabbed or :any.
  7728.  
  7729. :modifiers
  7730.         0 (default) or any of the modifier-keys: :shift :lock :control :mod-1
  7731.     :mod-2 :mod-3 :mod-4 or :mod-5.
  7732.  
  7733. :owner-p 
  7734.     is a boolean which indicates if the window is the owner.
  7735.  
  7736. :sync-pointer-p 
  7737.     is a predicate which indicates whether the pointer is in synchronous
  7738.     or asynchronous mode. 
  7739.  
  7740. :sync-keyboard-p    
  7741.     is a predicate which indicates whether the keyboard is in synchronous 
  7742.     or asynchronous mode. 
  7743.     
  7744. :time    is either a timestamp or current-time
  7745.  
  7746.  
  7747. This request establishes a passive grab on the keyboard.  If the specified key
  7748. (which can itself be a modifier key) is pressed (whether or not any specified
  7749. modifier keys are down), and either a) window is an ancestor of (or is) the
  7750. focus window or b) window is a descendant of the focus window and contains the
  7751. pointer, and these constraints are not satisfied for any ancestor of window,
  7752. then the keyboard is actively grabbed as described in grab-keyboard, the
  7753. last-keyboard-grab time is set to the time at which the key was pressed (as
  7754. transmitted in the Key-Press event), and the key-press event is reported.  The
  7755. interpretation of the remaining arguments is as for grab-keyboard.  The active
  7756. grab is terminated (independent of the state of the modifier keys)
  7757. automatically when the specified key has been released.
  7758.  
  7759.  
  7760. A modifier key of :any is equivalent to issuing the request for all possible
  7761. modifier combinations (including the combination of no modifiers).  It is not
  7762. required that all modifiers specified have currently assigned keycodes.  A key
  7763. of :Any is equivalent to issuing the request for all possible keycodes.
  7764. Otherwise, the key must be in the range specified by min-keycode and
  7765. max-keycode in the connection setup.
  7766.  
  7767.  
  7768. (DEFUN ungrab-key (window key &KEY (modifiers 0))
  7769.   (DECLARE (TYPE window window)
  7770.        (TYPE (OR (MEMBER :any) card8) key)
  7771.        (TYPE modifier-mask :modifiers)))
  7772.  
  7773. window 
  7774.     The window whose key is to be grabbed.
  7775.  
  7776. key    The key to be grabbed or :any.
  7777.  
  7778. :modifiers
  7779.         0 (default) or any of the modifier-keys: :shift :lock :control :mod-1
  7780.     :mod-2 :mod-3 :mod-4 or :mod-5.
  7781.  
  7782. Ungrab-Key releases the key combination on the specified window if it was
  7783. grabbed by this client.  A modifiers of :any is equivalent to issuing the
  7784. request for all possible modifier combinations (including the combination of
  7785. no modifiers).  A key of :any is equivalent to issuing the request for all
  7786. possible keycodes.  Ungrab-Key has no effect on an active grab.
  7787.  
  7788.  
  7789.  
  7790.  
  7791. 9.4.5.  Grabbing the Server
  7792.  
  7793.  
  7794. (DEFMACRO with-server-grabbed ((display) &body body)
  7795.   ;; The body is not surrounded by a with-display.
  7796.   )
  7797.  
  7798.  
  7799. (DEFUN grab-server (display)
  7800.   (DECLARE (TYPE display display)))
  7801.  
  7802. display    Specifies the display connection to the X server. 
  7803.  
  7804.  
  7805. Disables processing of requests and close-downs on all connections other than
  7806. the one this request arrived on.
  7807.  
  7808.  
  7809. Ungrab-Server
  7810.  
  7811.  
  7812. (DEFUN ungrab-server (display)
  7813.   (DECLARE (TYPE display display)))
  7814.  
  7815. display    Specifies the display connection to the X server. 
  7816.  
  7817. Restarts processing of requests and close-downs on other connections.
  7818.  
  7819.  
  7820.  
  7821.  
  7822.     9.5.  Miscellaneous Control Functions
  7823.  
  7824.     9.6.  Keyboard Settings
  7825.  
  7826.     9.7.  Keyboard Encodings
  7827.  
  7828.     9.8. Screen Saver Utility
  7829.  
  7830.     9.9. Controlling Host Access
  7831.  
  7832.  
  7833.  
  7834.  
  7835.  
  7836.                  Chapter ??
  7837.  
  7838.                  Defining Extensions
  7839.  
  7840.  
  7841. (DEFMACRO define-gcontext-accessor (name &key default set-function
  7842.                                               copy-function)
  7843.   (DECLARE (TYPE symbol name)
  7844.            (TYPE t :default)
  7845.            (TYPE (FUNCTION (gcontext t) t) :set-function) ;; required
  7846.            (TYPE (OR null (FUNCTION (gcontext gcontext t) t))
  7847.                  :copy-function)))
  7848.  
  7849. name 
  7850.  
  7851. :default 
  7852.  
  7853. :set-function
  7854.  
  7855. :copy-function
  7856.  
  7857.  
  7858. This will define a new graphic context accessor called NAME.  Defines the
  7859. gcontext-NAME accessor function and its defsetf.  Graphic contexts will cache
  7860. DEFAULT-VALUE and the last value SETFED when gcontext-cache-p is true.  The
  7861. NAME keyword will be allowed in CREATE-GCONTEXT, WITH-GCONTEXT, and
  7862. COPY-GCONTEXT-COMPONENTS.  SET-FUNCTION will be called with parameters
  7863. (GCONTEXT NEW-VALUE) from create-gcontext, and force-gcontext-changes.
  7864. COPY-FUNCTION will be called with parameters (src-gc dst-gc src-value) from
  7865. copy-gcontext and copy-gcontext-components.  The copy-function defaults to:
  7866.         (lambda (IGNORE dst-gc value)
  7867.           (IF value
  7868.               (,set-function dst-gc value)
  7869.               (ERROR "Can't copy unknown GContext component ~a" ',name)))
  7870.  
  7871.  
  7872.  
  7873.  
  7874.  
  7875.  
  7876. Appendix
  7877.  
  7878.  
  7879. Glossary of Terms
  7880.  
  7881.  
  7882.  
  7883.  
  7884. Access control list
  7885.  
  7886.         X maintains a list of hosts from which client programs may be run.  By
  7887.         default, only programs on the local host may use the display, plus any
  7888.         hosts specified in an initial list read by the server.  This "access
  7889.         control list" can be changed by clients on the local host.  Some
  7890.         server implementations may also implement other authorization
  7891.         mechanisms in addition to or in place of this mechanism.  The action
  7892.         of this mechanism may be conditional based on the authorization
  7893.         protocol name and data received by the server at connection setup.
  7894.  
  7895. Active grab
  7896.  
  7897.         A grab is "active" when the pointer or keyboard is actually owned by
  7898.         the single grabbing client.
  7899.  
  7900. Ancestors
  7901.  
  7902.         If W is an inferior of A, then A is an "ancestor" of W.
  7903.  
  7904. Atom
  7905.  
  7906.         An "atom" is a unique id corresponding to a string name.  Atoms are
  7907.         used to identify properties, types, and selections.
  7908.  
  7909. Backing store
  7910.  
  7911.         When a server maintains the contents of a window, the off-screen saved
  7912.         pixels are known as a "backing store".
  7913.  
  7914. Bit gravity
  7915.  
  7916.         When a window is resized, the contents of the window are not
  7917.         necessarily discarded.  It is possible to request the server (though
  7918.         no guarantees are made) to relocate the previous contents to some
  7919.         region of the window.  This attraction of window contents for some
  7920.         location of a window is known as "bit gravity".
  7921.  
  7922. Bitmap
  7923.  
  7924.         A "bitmap" is a pixmap of depth one.
  7925.  
  7926. Button grabbing
  7927.  
  7928.         Buttons on the pointer may be passively "grabbed" by a client.  When
  7929.         the button is pressed, the pointer is then actively grabbed by the
  7930.         client.
  7931.  
  7932. Byte order
  7933.  
  7934.         For image (pixmap/bitmap) data, byte order is defined by the server,
  7935.         and clients with different native byte ordering must swap bytes as
  7936.         necessary.  For all other parts of the protocol, the byte order is
  7937.         defined by the client, and the server swaps bytes as necessary.
  7938.  
  7939. Children
  7940.  
  7941.         The "children" of a window are its first-level subwindows.
  7942.  
  7943. Client
  7944.  
  7945.         An application program connects to the window system server by some
  7946.         interprocess communication (IPC) path, such as a TCP connection or a
  7947.         shared memory buffer.  This program is referred to as a "client" of
  7948.         the window system server.  More precisely, the client is the IPC path
  7949.         itself; a program with multiple paths open to the server is viewed as
  7950.         multiple clients by the protocol.  Resource lifetimes are controlled
  7951.         by connection lifetimes, not by program lifetimes.
  7952.  
  7953. Clipping regions
  7954.  
  7955.         In a graphic context, a bitmap or list of rectangles can be specified
  7956.         to restrict output to a particular region of the window.  The image
  7957.         defined by the bitmap or rectangles is called a "clipping region".
  7958.  
  7959. Colormap
  7960.  
  7961.         A "colormap" consists of a set of entries defining color values.  The
  7962.         colormap associated with a window is used to display the contents of
  7963.         the window; each pixel value indexes the colormap to produce RGB
  7964.         values that drive the guns of a monitor.  Depending on hardware
  7965.         limitations, one or more colormaps may be installed at one time, such
  7966.         that windows associated with those maps display with correct colors.
  7967.  
  7968. Connection
  7969.  
  7970.         The IPC path between the server and client program is known as a
  7971.         "connection".  A client program typically (but not necessarily) has
  7972.         one connection to the server over which requests and events are sent.
  7973.  
  7974. Containment
  7975.  
  7976.         A window "contains" the pointer if the window is viewable and the
  7977.         hotspot of the cursor is within a visible region of the window or a
  7978.         visible region of one of its inferiors.  The border of the window is
  7979.         included as part of the window for containment.  The pointer is "in" a
  7980.         window if the window contains the pointer but no inferior contains the
  7981.         pointer.
  7982.  
  7983. Coordinate system
  7984.  
  7985.         The coordinate system has X horizontal and Y vertical, with the origin
  7986.         [0, 0] at the upper left.  Coordinates are discrete, and in terms of
  7987.         pixels.  Each window and pixmap has its own coordinate system.  For a
  7988.         window, the origin is at the inside upper left, inside the border.
  7989.  
  7990. Cursor
  7991.  
  7992.         A "cursor" is the visible shape of the pointer on a screen.  It
  7993.         consists of a hot spot, a source bitmap, a shape bitmap, and a pair of
  7994.         colors.  The cursor defined for a window controls the visible
  7995.         appearance when the pointer is in that window.
  7996.  
  7997. Depth
  7998.  
  7999.         The "depth" of a window or pixmap is number of bits per pixel it has.
  8000.         The depth of a graphic context is the depth of the drawables it can
  8001.         be used in conjunction with for graphics output.
  8002.  
  8003. Device
  8004.  
  8005.         Keyboards, mice, tablets, track-balls, button boxes, etc.  are all
  8006.         collectively known as input "devices".  The core protocol only deals
  8007.         with two devices, "the keyboard" and "the pointer".
  8008.  
  8009. Direct Color
  8010.  
  8011.         A class of colormap in which a pixel value is decomposed into three
  8012.         separate subfields for indexing.  One subfield indexes an array to
  8013.         produce red intensity values, the second subfield indexes a second
  8014.         array to produce blue intensity values, and the third subfield indexes
  8015.         a third array to produce green intensity values.  The RGB values can
  8016.         be changed dynamically.
  8017.  
  8018. Drawable
  8019.  
  8020.         Both windows and pixmaps may be used as sources and destinations in
  8021.         graphics operations.  These are collectively known as "drawables".
  8022.         However, an Input-only window cannot be used as a source or destination
  8023.         in a graphics operation.
  8024.  
  8025. Event
  8026.  
  8027.         Clients are informed of information asynchronously via "events".
  8028.         These events may be either asynchronously generated from devices, or
  8029.         generated as side effects of client requests.  Events are grouped into
  8030.         types; events are never sent to a client by the server unless the
  8031.         client has specifically asked to be informed of that type of event,
  8032.         but other clients can force events to be sent to other clients.
  8033.         Events are typically reported relative to a window.
  8034.  
  8035. Event mask
  8036.  
  8037.         Events are requested relative to a window.  The set of event types a
  8038.         client requests relative to a window described using an "event mask".
  8039.  
  8040. Event synchronization
  8041.  
  8042.         There are certain race conditions possible when demultiplexing device
  8043.         events to clients (in particular deciding where pointer and keyboard
  8044.         events should be sent when in the middle of window management
  8045.         operations).  The event synchronization mechanism allows synchronous
  8046.         processing of device events.
  8047.  
  8048. Event propagation
  8049.  
  8050.         Device-related events "propagate" from the source window to ancestor
  8051.         windows until some client has expressed interest in handling that type
  8052.         of event, or until the event is discarded explicitly.
  8053.  
  8054. Event source
  8055.  
  8056.         The smallest window containing the pointer is the "source" of a device
  8057.     related event.
  8058.  
  8059. Exposure event
  8060.  
  8061.         Servers do not guarantee to preserve the contents of windows when
  8062.         windows are obscured or reconfigured.  "Exposure" events are sent to
  8063.         clients to inform them when contents of regions of windows have been
  8064.         lost.
  8065.  
  8066. Extension
  8067.  
  8068.         Named "extensions" to the core protocol can be defined to extend the
  8069.         system.  Extension to output requests, resources, and event types are
  8070.         all possible, and expected.
  8071.  
  8072. Focus window
  8073.  
  8074.     The "focus window" is another term for the input focus.
  8075.  
  8076. Font
  8077.  
  8078.         A "font" is a matrix of glyphs (typically characters).  The protocol
  8079.         does no translation or interpretation of character sets.  The client
  8080.         simply indicates values used to index the glyph array.  A font
  8081.         contains additional metric information to determine inter-glyph and
  8082.         inter-line spacing.
  8083.  
  8084. Glyph
  8085.  
  8086.         A "glyph" is an image, typically of a character, in a font.
  8087.  
  8088. Grab
  8089.  
  8090.         Keyboard keys, the keyboard, pointer buttons, the pointer, and the
  8091.         server can be "grabbed" for exclusive use by a client.  In general,
  8092.         these facilities are not intended to be used by normal applications,
  8093.         but are intended for various input and window managers to implement
  8094.         various styles of user interfaces.
  8095.  
  8096. Gray Scale
  8097.  
  8098.         Gray Scale can be viewed as a degenerate case of Pseudo Color, in
  8099.         which the red, green, and blue values in any given colormap entry are
  8100.         equal, thus producing shades of gray.  The gray values can be changed
  8101.         dynamically.
  8102.  
  8103. GC, GContext
  8104.  
  8105.     Shorthand for "graphic context".
  8106.  
  8107. Graphic context
  8108.  
  8109.         Various information for graphics output is stored in a "graphic
  8110.         context" (or "GC" or "gcontext"), such as foreground pixel, background
  8111.         pixel, line width, clipping region, etc.  A graphic context can only
  8112.         be used with drawables that have the same root and the same depth as
  8113.         the graphic context.
  8114.  
  8115. Hotspot
  8116.  
  8117.         A cursor has an associated "hot spot" which defines a point in the
  8118.         cursor that corresponds to the coordinates reported for the pointer.
  8119.  
  8120. Identifier
  8121.  
  8122.         Each resource has an "identifier", a unique value associated with it
  8123.         that clients use to name the resource.  An identifier can be used over
  8124.         any connection to name the resource.
  8125.  
  8126. Inferiors
  8127.  
  8128.         The "inferiors" of a window are all of the subwindows nested below it:
  8129.         the children, the children's children, etc.
  8130.  
  8131. Input focus
  8132.  
  8133.         The "input focus" is normally a window defining the scope for
  8134.         processing of keyboard input.  If a generated keyboard event would
  8135.         normally be reported to this window or one of its inferiors, the event
  8136.         is reported normally; otherwise, the event is reported with respect to
  8137.         the focus window.  The input focus also can be set such that all
  8138.         keyboard events are discarded, and also can be set such that the focus
  8139.         window is dynamically taken to be the root window of whatever screen
  8140.         the pointer is on at each keyboard event.
  8141.  
  8142. Input manager
  8143.  
  8144.         Control over keyboard input is typically provided by an "input
  8145.     manager" client.
  8146.  
  8147. Input-Only window
  8148.  
  8149.         A window that cannot be used for graphics requests.  Input-Only windows
  8150.         are "invisible", and can be used to control such things as cursors,
  8151.         input event generation, and grabbing.  Input-Only windows cannot have
  8152.         Input/Output windows as inferiors.
  8153.  
  8154. Input/Output window
  8155.  
  8156.         The "normal" kind of opaque window, used for both input and output.
  8157.         Input/Output windows can have both Input/Output and Input-Only windows as
  8158.         inferiors.
  8159.  
  8160. Key grabbing
  8161.  
  8162.         Keys on the keyboard may be passively "grabbed" by a client.  When the
  8163.         key is pressed, the keyboard is then actively grabbed by the client.
  8164.  
  8165. Keyboard grabbing
  8166.  
  8167.         A client can actively "grab" control of the keyboard, and key events
  8168.         will be sent to that client rather than the client the events would
  8169.         normally have been sent to.
  8170.  
  8171. Keysym
  8172.  
  8173.     An encoding of a symbol on a keycap on a keyboard.
  8174.  
  8175. Mapped
  8176.  
  8177.         A window is said to be "mapped" if a map call has been performed on
  8178.         it.  Unmapped windows and their inferiors are never viewable or
  8179.         visible.
  8180.  
  8181. Modifier keys
  8182.  
  8183.         Shift, Control, Meta, Super, Hyper, ALT, Compose, Apple, CapsLock,
  8184.         ShiftLock, and similar keys are called "modifier" keys.
  8185.  
  8186. Monochrome
  8187.  
  8188.         A special case of Static Gray, in which there are only two colormap
  8189.     entries.
  8190.  
  8191. Obscure
  8192.  
  8193.         A window is "obscured" if some other window "obscures" it.  Window A
  8194.         "obscures" window B if both are viewable Input/Output windows and A is
  8195.         higher in the global stacking order, and the rectangle defined by the
  8196.         outside edges of A intersects the rectangle defined by the outside
  8197.         edges of B.  Note the (fine) distinction with "occludes".  Also note
  8198.         that window borders are included in the calculation.  Also note that a
  8199.         window can be obscured and yet still have visible regions.
  8200.  
  8201. Occlude
  8202.  
  8203.         A window is "occluded" if some other window "occludes" it.  Window A
  8204.         "occludes" window B if both are mapped and A is higher in the global
  8205.         stacking order, and the rectangle defined by the outside edges of A
  8206.         intersects the rectangle defined by the outside edges of B.  Note the
  8207.         (fine) distinction with "obscures".  Also note that window borders are
  8208.         included in the calculation.
  8209.  
  8210. Padding
  8211.  
  8212.         Some padding bytes are inserted in the data stream to maintain
  8213.         alignment of the protocol requests on natural boundaries.  This
  8214.         increases ease of portability to some machine architectures.
  8215.  
  8216. Parent window
  8217.  
  8218.         If C is a child of P, then P is the "parent" of C.
  8219.  
  8220. Passive grab
  8221.  
  8222.     Grabbing a key or button is a "passive" grab.  The grab activates when the key or
  8223.     button is actually pressed.
  8224.  
  8225. Pixel value
  8226.  
  8227.         A "pixel" is an N-bit value, where N is the number of bit planes used
  8228.         in (i.e., the depth of) a particular window or pixmap.  For a window,
  8229.         a pixel value indexes a colormap to derive an actual color to be
  8230.         displayed.
  8231.  
  8232. Pixmap
  8233.  
  8234.         A "pixmap" is a three dimensional array of bits.  A pixmap is normally
  8235.         thought of as a two dimensional array of pixels, where each pixel can
  8236.         be a value from 0 to (2^N)-1, where N is the depth (z axis) of the
  8237.         pixmap.  A pixmap can also be thought of as a stack of N bitmaps.
  8238.  
  8239. Plane
  8240.  
  8241.         When a pixmap or window is thought of as a stack of bitmaps, each
  8242.         bitmap is called a "plane" or "bit plane".
  8243.  
  8244. Plane mask
  8245.  
  8246.         Graphics operations can be restricted to only affect a subset of bit
  8247.         planes of a destination.  A "plane mask" is a bit mask describing
  8248.         which planes are to be modified, and is stored in a graphic context.
  8249.  
  8250. Pointer
  8251.  
  8252.         The "pointer" is the pointing device attached to the cursor, and
  8253.     tracked on the screens.
  8254.  
  8255. Pointer grabbing
  8256.  
  8257.         A client can actively "grab" control of the pointer, and button and
  8258.         motion events will be sent to that client rather than the client the
  8259.         events would normally have been sent to.
  8260.  
  8261. Pointing device
  8262.  
  8263.         A "pointing device" is typically a mouse or tablet, or some other
  8264.         device with effective dimensional motion.  There is only one visible
  8265.         cursor is defined by the core protocol, and it tracks whatever
  8266.         pointing device is attached as the pointer.
  8267.  
  8268. Property
  8269.  
  8270.         Windows may have associated "properties", consisting of a name, a
  8271.         type, a data format, and some data.  The protocol places no
  8272.         interpretation on properties, they are intended as a general-purpose
  8273.         naming mechanism for clients.  For example, clients might share
  8274.         information such as resize hints, program names, and icon formats with
  8275.         a window manager via properties.
  8276.  
  8277. Property list
  8278.  
  8279.         The "property list" of a window is the list of properties that have
  8280.         been defined for the window.
  8281.  
  8282. Pseudo Color
  8283.  
  8284.         A class of colormap in which a pixel value indexes the colormap to
  8285.         produce independent red, green, and blue values.  That is, the
  8286.         colormap is viewed as an array of triples (RGB values).  The RGB
  8287.         values can be changed dynamically.
  8288.  
  8289. Redirecting control
  8290.  
  8291.         Window managers (or client programs) may wish to enforce window layout
  8292.         policy in various ways.  When a client attempts to change the size or
  8293.         position of a window, the operation may be "redirected" to a specified
  8294.         client, rather than the operation actually being performed.
  8295.  
  8296. Reply
  8297.  
  8298.         Information requested by a client program is sent back to the client
  8299.         with a "reply".  Both events and replies are multiplexed on the same
  8300.         connection.  Most requests do not generate replies.  Some requests
  8301.         generate multiple replies.
  8302.  
  8303. Request
  8304.  
  8305.         A command to the server is called a "request".  It is a single block
  8306.         of data sent over a connection.
  8307.  
  8308. Resource
  8309.  
  8310.         Windows, pixmaps, cursors, fonts, graphic contexts, and colormaps are
  8311.         known as "resources".  They all have unique identifiers associated
  8312.         with them for naming purposes.  The lifetime of a resource is bounded
  8313.         by the lifetime of the connection over which the resource was created.
  8314.  
  8315. RGB values
  8316.  
  8317.         "Red, Green, and Blue" intensity values used to define color.  These
  8318.         values are always represented as 16 bit unsigned numbers, with zero
  8319.         being minimum intensity and 65535 being the maximum intensity.  The
  8320.         values are scaled by the server to match the display hardware.
  8321.  
  8322. Root
  8323.  
  8324.         The "root" of a pixmap or graphic context is the same as the root of
  8325.         whatever drawable was used when the pixmap or graphic context was
  8326.         created.  The "root" of a window is the root window under which the
  8327.         window was created.
  8328.  
  8329. Root window
  8330.  
  8331.         Each screen has a "root window" covering it.  It cannot be
  8332.         reconfigured or unmapped, but otherwise acts as a full fledged window.
  8333.         A root window has no parent.
  8334.  
  8335. Save set
  8336.  
  8337.         The "save set" of a client is a list of other client's windows which,
  8338.         if they are inferiors of one of the client's windows at connection
  8339.         close, should not be destroyed, and which should be remapped if it is
  8340.         unmapped.  Save sets are typically used by window managers to avoid
  8341.         lost windows if the manager should terminate abnormally.
  8342.  
  8343. Scanline
  8344.  
  8345.         A "scanline" is a list of pixel or bit values viewed as a horizontal
  8346.         row (all values having the same y coordinate) of an image, with the
  8347.         values ordered by increasing x coordinate.
  8348.  
  8349. Scanline order
  8350.  
  8351.         An image represented in "scanline order" contains scanlines ordered by
  8352.         increasing y coordinate.
  8353.  
  8354. Screen
  8355.  
  8356.         A server may provide several independent "screens", which typically
  8357.         have physically independent monitors.  This would be the expected
  8358.         configuration when there is only a single keyboard and pointer shared
  8359.         among the screens.
  8360.  
  8361. Selection
  8362.  
  8363.         A "selection" can be thought of as an indirect property with dynamic
  8364.         type.  That is, rather than having the property stored in the server,
  8365.         it is maintained by some client (the "owner").  A selection is global
  8366.         in nature, being thought of as belonging to the user (but maintained
  8367.         by clients), rather than being private to a particular window
  8368.         subhierarchy or a particular set of clients.  When a client asks for
  8369.         the contents of a selection, it specifies a selection "target type".
  8370.         This target type can be used to control the transmitted representation
  8371.         of the contents.  For example, if the selection is "the last thing the
  8372.         user clicked on", and that is currently an image, then the target type
  8373.         might specify whether the contents of the image should be sent in
  8374.         XYFormat or ZFormat.  The target type can also be used to control the
  8375.         class of contents transmitted; e.g., asking for the "looks" (fonts,
  8376.         line spacing, indentation, etc.) of a paragraph selection, rather than
  8377.         the text of the paragraph.  The target type can also be used for other
  8378.         purposes; the semantics is not constrained by the protocol.
  8379.  
  8380. Server
  8381.  
  8382.         The "server" provides the basic windowing mechanism.  It handles IPC
  8383.         connections from clients, demultiplexes graphics requests onto the
  8384.         screens, and multiplexes input back to the appropriate clients.
  8385.     
  8386. Server grabbing
  8387.  
  8388.         The server can be "grabbed" by a single client for exclusive use.
  8389.         This prevents processing of any requests from other client connections
  8390.         until the grab is complete.  This is typically only a transient state
  8391.         for such things as rubber-banding and pop-up menus, or to execute
  8392.         requests indivisibly.
  8393.  
  8394. Sibling
  8395.  
  8396.         Children of the same parent window are known as "sibling" windows.
  8397.  
  8398. Static Color
  8399.  
  8400.         Static Color can be viewed as a degenerate case of Pseudo Color, in
  8401.         which the RGB values are predefined and read-only.
  8402.  
  8403. Static Gray
  8404.  
  8405.         Static Gray can be viewed as a degenerate case of Gray Scale, in which
  8406.         the gray values are predefined and read-only.  The values are
  8407.         typically (near-)linear increasing ramps.
  8408.  
  8409. Stacking order
  8410.  
  8411.         Sibling windows may "stack" on top of each other.  Windows above both
  8412.         obscure and occlude lower windows.  This is similar to paper on a
  8413.         desk.  The relationship between sibling windows is known as the
  8414.         "stacking order".
  8415.  
  8416. Stipple
  8417.  
  8418.         A "stipple pattern" is a bitmap that is used to tile a region to serve
  8419.         as an additional clip mask for a fill operation with the foreground
  8420.         color.
  8421.  
  8422. Tile
  8423.  
  8424.         A pixmap can be replicated in two dimensions to "tile" a region.  The
  8425.         pixmap itself is also known as a "tile".
  8426.  
  8427. Timestamp
  8428.  
  8429.         A time value, expressed in milliseconds, typically since the last
  8430.         server reset.  Timestamp values wrap around (after about 49.7 days).
  8431.         The server, given its current time is represented by timestamp T,
  8432.         always interprets timestamps from clients by treating half of the
  8433.         timestamp space as being earlier in time than T, and half of the
  8434.         timestamp space as being later in time than T.  One timestamp value
  8435.         (named CurrentTime) is never generated by the server; this value is
  8436.         reserved for use in requests to represent the current server time.
  8437.  
  8438. True Color
  8439.  
  8440.         True Color can be viewed as a degenerate case of Direct Color, in
  8441.         which the subfields in the pixel value directly encode the
  8442.         corresponding RGB values.  That is, the colormap has predefined
  8443.         read-only RGB values.  The values are typically (near-)linear
  8444.         increasing ramps.
  8445.  
  8446. Type
  8447.  
  8448.         A type is an arbitrary atom used to identify the interpretation of
  8449.         property data.  Types are completely uninterpreted by the server; they
  8450.         are solely for the benefit of clients.
  8451.  
  8452. Viewable
  8453.  
  8454.         A window is "viewable" if it and all of its ancestors are mapped.
  8455.         This does not imply that any portion of the window is actually
  8456.         visible.  Graphics requests can be performed on a window when it is
  8457.         not viewable, but output will not be retained unless the server is
  8458.         maintaining backing store.
  8459.  
  8460. Visible
  8461.  
  8462.         A region of a window is "visible" if someone looking at the screen can
  8463.         actually "see" it: the window is viewable and the region is not
  8464.         occluded by any other window.
  8465.  
  8466. Window gravity
  8467.  
  8468.         When windows are resized, subwindows may be repositioned automatically
  8469.         relative to some position in the window.  This attraction of a
  8470.         subwindow to some part of its parent is known as "window gravity".
  8471.  
  8472. Window manager
  8473.  
  8474.         Manipulation of windows on the screen, and much of the user interface
  8475.         (policy) is typically provided by a "window manager" client.
  8476.  
  8477. XYFormat
  8478.  
  8479.         The data for a pixmap is said to be in "XYFormat" if it is organized
  8480.         as a set of bitmaps representing individual bit planes, with the
  8481.         planes appearing from most to least significant in bit order.
  8482.  
  8483. ZFormat
  8484.  
  8485.         The data for a pixmap is said to be in "ZFormat" if it is organized as
  8486.         a set of pixel values in scanline order.
  8487.  
  8488.  
  8489.  
  8490.